diff --git a/app/controllers/start_form_self_controller.rb b/app/controllers/start_form_self_controller.rb index 6712262d..c7124a1a 100644 --- a/app/controllers/start_form_self_controller.rb +++ b/app/controllers/start_form_self_controller.rb @@ -10,6 +10,9 @@ class StartFormSelfController < ApplicationController @submitter = Submitters::StartForm.build_submitters_scope(@template, exclude_completed: true, source: :self) .find_or_initialize_by(email: current_user.email) + @submitter = Submitter.new(email: current_user.email) if @submitter.persisted? && + outdated_template_fields?(@submitter, @template) + if (is_new_record = @submitter.new_record?) @submitter.name = current_user.full_name @@ -33,6 +36,12 @@ class StartFormSelfController < ApplicationController private + def outdated_template_fields?(submitter, template) + template_fields = submitter.submission.template_fields + + template_fields.present? && template_fields != template.fields + end + def authorize_start! authorize!(:read, @template)