Last active
August 29, 2015 14:02
-
-
Save aypn0s/7d4ad783170b293a75bb to your computer and use it in GitHub Desktop.
Devise store session
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
| # Application controller | |
| before_action :store_location | |
| def store_location | |
| if request.path != '/users/sign_in' && | |
| request.path != '/users/sign_up' && | |
| request.path != '/users/password/new' && | |
| request.path != '/users/password/edit' && | |
| !request.xhr? && !request.post? && !request.put? | |
| 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