makes devise remember the last visited page before login in

This commit is contained in:
kikito
2015-12-21 16:44:30 +01:00
parent 02bdeec164
commit 866e04f776
2 changed files with 15 additions and 8 deletions

View File

@@ -10,6 +10,7 @@ class ApplicationController < ActionController::Base
before_action :ensure_signup_complete
before_action :set_locale
before_action :track_email_campaign
before_action :set_return_url
check_authorization unless: :devise_controller?
self.responder = ApplicationResponder
@@ -101,4 +102,10 @@ class ApplicationController < ActionController::Base
ahoy.track campaign.name if campaign.present?
end
end
def set_return_url
if !devise_controller? && controller_name != 'welcome' && is_navigational_format?
store_location_for(:user, request.path)
end
end
end