Maybe this is a simple question, but I have rails 4 app using omniauth and devise and I can't figure out how to set a route for the failure to authenticate a user specifically on permission denied. How would I do this? I need to send permission denials to a specific place in my app.
user = User.from_omniauth(env["omniauth.auth"])
if user.persisted?
flash[:notice] = "You are in..!!!"
sign_in_and_redirect(user)
else
session["devise.user_attributes"] = user.attributes
redirect_to new_user_registration_url
end
def failure
#handle you logic here..
redirect_to root_path
end