diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 00be6710..504c66f0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,23 +3,6 @@ class ApplicationController < ActionController::Base before_action :set_paper_trail_whodunnit before_action :configure_permitted_parameters, if: :devise_controller? - before_action :store_user_location!, if: :storable_location? - - private - - def storable_location? - if devise_controller? && action_name == "edit" && current_user.nil? - redirect_to new_user_session_path - return true - end - - request.get? && is_navigational_format? && !devise_controller? && !request.xhr? - end - - def store_user_location! - # :user is the scope we are authenticating - store_location_for(:user, request.fullpath) - end protected diff --git a/app/controllers/base_controllers/authenticate_controller.rb b/app/controllers/base_controllers/authenticate_controller.rb index aeec09a0..a7e966d1 100644 --- a/app/controllers/base_controllers/authenticate_controller.rb +++ b/app/controllers/base_controllers/authenticate_controller.rb @@ -3,6 +3,23 @@ module BaseControllers class AuthenticateController < ApplicationController before_action :authenticate_user! + before_action :store_user_location!, if: :storable_location? + + private + + def storable_location? + if devise_controller? && action_name == "edit" && current_user.nil? + redirect_to new_user_session_path + return true + end + + request.get? && is_navigational_format? && !devise_controller? && !request.xhr? + end + + def store_user_location! + # :user is the scope we are authenticating + store_location_for(:user, request.fullpath) + end protected