Add form update

This commit is contained in:
2020-04-14 14:25:38 +02:00
parent 4821227895
commit f12238fbd4
4 changed files with 45 additions and 15 deletions

View File

@@ -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