From 67e1b7718ab5c9fd50b68abc9f1726491f77b221 Mon Sep 17 00:00:00 2001 From: James Dinkel Date: Sun, 24 Aug 2025 11:15:57 -0500 Subject: [PATCH] add get and post for adding assistant --- app.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app.rb b/app.rb index dd4cbf6..f590e41 100644 --- a/app.rb +++ b/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