title: How can I redirect a user to a specific page when registration fails?
body: <p>I have a Rails app which uses Devise for user sign up / authentication. Both the sign up form and the login form are at the root of my domain.</p>
  
  <p>When user registration fails (for example because they enter an email address which is already taken), by default Devise redirects to <code>/users</code>.</p>
  
  <p>How can I change that? I would like the user to be directed to <code>/</code></p>
  
  <p>I have implemented this successfully for a failed login attempt, with the following code:</p>
  
  <pre><code>class CustomFailure &lt; Devise::FailureApp
    def redirect_url
      "/"
    end
  
    def respond
      if http_auth?
        http_auth
      else
        redirect
      end
    end
  end
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>config.warden do |manager|
    manager.failure_app = CustomFailure
  end
  </code></pre>
  
  <p>As detailed <a href="https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-when-the-user-can-not-be-authenticated" rel="nofollow">on the project's homepage</a>. </p>
  
  <p>Is there any way to extend / alter this so that failed registrations also redirect to the root of my domain? </p>
  
  <p>I'm using Ruby 2.2.0, Rails 4.2.0 and Devise 3.4.1.</p>