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