Added new views that use the database

This commit is contained in:
James 2023-12-28 22:39:02 -06:00
parent bffbab8fbc
commit 14f1f3daa6
3 changed files with 18 additions and 4 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/.rake_tasks~
/temp.db

15
app.rb
View file

@ -14,10 +14,17 @@ class App < Roda
view :index
end
r.is String do |name|
@page_title = 'A Custom Greeting'
@name = name.capitalize
view :greeting
r.is 'users' do
@users = User.order(:id)
view :users
end
r.on 'hello' do
r.is String do |name|
@page_title = 'A Custom Greeting'
@name = name.capitalize
view :greeting
end
end
end
end

5
views/users.erb Normal file
View file

@ -0,0 +1,5 @@
<% for u in @users do %>
<p class="subtitle is-3">
Hello, <%= u.name %>! You're #<%= u.id %>!
</p>
<% end %>