Does anyone know the options for Devises `authenticate_user!`?
Like the title says, I'm looking for the options for devises automatic class authenticate_user!
, specifically, I want it to redirect_to开发者_JAVA技巧 to '/' and not '/users/sign_in'
Do the following:
In config/initializers/devise.rb:
config.warden do |manager|
manager.failure_app = CustomAuthenticationFailure
end
Create a new file called lib/custom_authentication_failure.rb:
class CustomAuthenticationFailure < Devise::FailureApp
protected
def redirect_url
root_path #or whatever route in your app that points to '/'
end
end
And this to your config/application.rb:
config.autoload_paths += %W(#{config.root}/lib)
I think you can find your answer here: Devise Wiki
In particular, I think this should do the trick:
Change default sign in and sign out routes
精彩评论