add get and post for adding assistant
This commit is contained in:
parent
c95328f230
commit
67e1b7718a
16
app.rb
16
app.rb
|
|
@ -22,5 +22,21 @@ class App < Roda
|
|||
# renders index.erb inside layout.erb
|
||||
view :index
|
||||
end
|
||||
|
||||
r.on 'assistants' do
|
||||
r.get 'new' do
|
||||
@page_title = 'Create New Assistant'
|
||||
@assistant = Assistant.new
|
||||
view :edit
|
||||
end
|
||||
r.post do
|
||||
@assistant = Assistant.new(r.params)
|
||||
if @assistant.save
|
||||
r.redirect '/' # change to just r.redirect when get a host.org/assistants page up
|
||||
else
|
||||
r.halt(404)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue