diff --git a/app/controllers/case_logs_controller.rb b/app/controllers/case_logs_controller.rb index c4619b169..93cc367db 100644 --- a/app/controllers/case_logs_controller.rb +++ b/app/controllers/case_logs_controller.rb @@ -26,7 +26,7 @@ class CaseLogsController < ApplicationController previous_page = params[:case_log][:previous_page] questions_for_page = form.questions_for_page(previous_page).keys answers_for_page = page_params(questions_for_page).select { |k, _v| questions_for_page.include?(k) } - @case_log.previous_page(previous_page) + @case_log.previous_page = previous_page if @case_log.update(answers_for_page) redirect_path = form.next_page_redirect_path(previous_page) redirect_to(send(redirect_path, @case_log)) diff --git a/app/models/case_log.rb b/app/models/case_log.rb index d81b83f2c..bb8dbe54c 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -28,13 +28,9 @@ end class CaseLog < ApplicationRecord validate :instance_validations - @previous_page + attr_writer :previous_page enum status: { "in progress" => 0, "submitted" => 1 } - def previous_page(value) - @previous_page = value - end - def instance_validations validates_with CaseLogValidator, ({ previous_page: @previous_page } || {}) end