Added new views that use the database
This commit is contained in:
parent
bffbab8fbc
commit
14f1f3daa6
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/.rake_tasks~
|
||||
/temp.db
|
||||
7
app.rb
7
app.rb
|
|
@ -14,11 +14,18 @@ class App < Roda
|
|||
view :index
|
||||
end
|
||||
|
||||
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
5
views/users.erb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<% for u in @users do %>
|
||||
<p class="subtitle is-3">
|
||||
Hello, <%= u.name %>! You're #<%= u.id %>!
|
||||
</p>
|
||||
<% end %>
|
||||
Loading…
Reference in a new issue