Created
March 5, 2014 10:05
-
-
Save birchestx/9364518 to your computer and use it in GitHub Desktop.
Stop Devise from going to sign_in page after session timeout From https://github.com/plataformatec/devise/wiki/How-To:-Do-not-redirect-to-login-page-after-session-timeout
This file contains 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
In config/initializers/devise.rb configure your custom failure app: | |
config.warden do |manager| | |
manager.failure_app = CustomFailureApp | |
end | |
And in lib/custom_failure_app.rb: | |
class CustomFailureApp < Devise::FailureApp | |
def redirect | |
message = warden.message || warden_options[:message] | |
if message == :timeout | |
redirect_to attempted_path | |
else | |
super | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment