diff --git a/app/controllers/forms_controller.rb b/app/controllers/forms_controller.rb index 92c2ece..4b0ac01 100644 --- a/app/controllers/forms_controller.rb +++ b/app/controllers/forms_controller.rb @@ -25,6 +25,19 @@ class FormsController < ApplicationController end end + def edit + @form = current_user.forms.find_by!(token: params[:id]) + end + + def update + @form = current_user.forms.find_by!(token: params[:id]) + if @form.update(form_params) + redirect_to form_url(@form) + else + render :edit + end + end + def form @form = Form.find_by!(token: params[:id]) end diff --git a/app/views/forms/_form.html.erb b/app/views/forms/_form.html.erb new file mode 100644 index 0000000..c03993b --- /dev/null +++ b/app/views/forms/_form.html.erb @@ -0,0 +1,15 @@ +<%= form_for form, local: true do |f| %> +