Last active
October 24, 2017 20:53
-
-
Save pottedmeat7/383029b0b3cc8271660230817114ca13 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before_filter :store_location | |
def store_location | |
# store last url - this is needed for post-login redirect to whatever the user last visited. | |
return unless request.get? | |
if ( !request.path.include?("/log-in") && | |
!request.path.include?("/users/confirmation") && | |
!request.path.include?("/users/password/new") && | |
!request.path.include?("/users/password/edit") && | |
!request.xhr?) # don't store ajax calls | |
session[:previous_url] = request.fullpath | |
end | |
end | |
def after_sign_in_path_for(resource) | |
session[:previous_url] || root_path | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment