Take the 2-minute tour ×

I'm using devise and have a quick question. How can I redirect the :authenticate_user! before_filter to the user sign up page instead of sign in? I've been going through https://github.com/plataformatec/devise/blob/master/lib/devise/controllers/helpers.rb but haven't had much luck figuring out a solution.

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

You're going to have to create a custom FailureApp that inherits from Devise's FailureApp as seen here: https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-when-the-user-can-not-be-authenticated

share|improve this answer
The issue with this approach (for the one in this link at least) is that it pushes you to signup if you fail to put in your password correctly on signup (for example)... –  Andy Hayden May 30 '13 at 15:24
add comment

I had a similar issue where I needed to redirect to the signup if the user was not logged in. I fixed it by adding a method to the application_controller.rb and using it as a before filter in the other controllers.

before_filter :auth_user

  def auth_user
    redirect_to new_user_registration_url unless user_signed_in?

share|improve this answer
Thanks! This worked! :D –  Sheharyar Dec 10 '12 at 15:32
Glad I could help =) –  Baconator507 Jun 25 '13 at 23:39
add comment

Your Answer


