diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index 168e4a768..d8462bd81 100644 --- a/app/controllers/form_controller.rb +++ b/app/controllers/form_controller.rb @@ -60,7 +60,6 @@ class FormController < ApplicationController end end - private def restore_error_field_values @@ -143,7 +142,7 @@ private end def new_log_request_referrer? - request.referer.split("/").include?("new") + request.referer&.split("/").include?("new") end def is_referrer_check_answers? diff --git a/app/controllers/lettings_logs_controller.rb b/app/controllers/lettings_logs_controller.rb index 056374079..da422fc54 100644 --- a/app/controllers/lettings_logs_controller.rb +++ b/app/controllers/lettings_logs_controller.rb @@ -101,7 +101,7 @@ private @log = LettingsLog.find_by(id: params[:id]) end - def post_create_redirect_url(log) - lettings_log_url(log) + def post_create_redirect_url + new_log_lettings_logs_path end end diff --git a/app/controllers/logs_controller.rb b/app/controllers/logs_controller.rb index ba7b2cd7f..a099ed757 100644 --- a/app/controllers/logs_controller.rb +++ b/app/controllers/logs_controller.rb @@ -15,7 +15,7 @@ private respond_to do |format| format.html do - redirect_to(request.path.include?("sales") ? new_log_sales_logs_path : new_log_lettings_logs_path) + redirect_to(post_create_redirect_url) end format.json do if log.save diff --git a/app/controllers/sales_logs_controller.rb b/app/controllers/sales_logs_controller.rb index 81a4be9bd..24e09f206 100644 --- a/app/controllers/sales_logs_controller.rb +++ b/app/controllers/sales_logs_controller.rb @@ -40,8 +40,8 @@ class SalesLogsController < LogsController end end - def post_create_redirect_url(log) - sales_log_url(log) + def post_create_redirect_url + new_log_sales_logs_path end def permitted_log_params