0

Like once I'm ON sign_in page - I just want to sign in. But if it fails - I wanna get to the root path.

Right now my monkey patch is:

class Candidate::SessionsController < Devise::SessionsController
  def new
    if flash[:alert].present?
      redirect_to root_path, alert: flash[:alert]
    else
      render 'new', layout: false
    end
  end
end

But I want do it the right way; this is ugly.

Bob Gilmore
  • 12,608
  • 13
  • 46
  • 53
  • One of the answers in this post should help you -> http://stackoverflow.com/questions/5832631/devise-redirect-after-login-fail – usha Feb 25 '14 at 14:41

1 Answers1

0

They have this page in the devise wiki

https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-when-the-user-can-not-be-authenticated

also

Devise redirect after login fail

Community
  • 1
  • 1
emcanes
  • 1,398
  • 10
  • 7
  • Note that link-only answers are discouraged, SO answers should be the end-point of a search for a solution (vs. yet another stopover of references, which tend to get stale over time). Please consider adding a stand-alone synopsis here, keeping the link as a reference. – Bob Gilmore Feb 25 '14 at 15:24