Reputation: 6496
Like the title says, I'm looking for the options for devises automatic class authenticate_user!
, specifically, I want it to redirect_to to '/' and not '/users/sign_in'
Upvotes: 4
Views: 2135
Reputation: 1807
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)
Upvotes: 6
Reputation: 9691
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
Upvotes: 2