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'
Asked
Active
Viewed 2,129 times
4

Vasseurth
- 6,354
- 12
- 53
- 81
2 Answers
6
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)

noli
- 15,927
- 8
- 46
- 62

Kevin Tsoi
- 1,807
- 15
- 16
2
I think you can find your answer here: Devise Wiki
In particular, I think this should do the trick:

Benjamin Tan Wei Hao
- 9,621
- 3
- 30
- 56