I know there is a wiki page about it, but since I’m very new to Rails I am having lot of difficulties in understanding that page.
I had to override registration controller for my user. When user fails to signin I want him to be redirected to my custom signin page. But the application send him to the signin page inside the gem.
How can I accomplish that? Where should I put this class and how can I change it?
I have multiple models, each of them has a different signin page. How can I set the scope for each model?
class CustomFailure < Devise::FailureApp
def redirect_url
#return super unless [:worker, :employer, :user].include?(scope) #make it specific to a scope
new_user_session_url(:subdomain => 'secure')
end
# You need to override respond to eliminate recall
def respond
if http_auth?
http_auth
else
redirect
end
end
end
Devise is a powerful gem but some wiki pages don’t consider that there can be lots of new programmers
I have my auth failure over-ride class in
/libdirectly.Here’s a bare-bones version that shows how to handle different scopes for users.
You’d put this class in
/lib/my_auth_failure.rb