Skip to content

How To: Change Default Sign_up Registration Path with Custom Path

Sunny Ripert edited this page Aug 19, 2016 · 5 revisions

Overview

Devise uses the default sign_path which is /users/sign_up. If for some reason you would like to change the default path, assuming you have not generated a custom registration/sign_up controller, to domain.com/sign_up:

# top level of your routes.rb
Rails.application.routes.draw do
  devise_scope :user do
    get "/sign_in" => "devise/sessions#new" # custom path to login/sign_in
    get "/sign_up" => "devise/registrations#new", as: "new_user_registration" # custom path to sign_up/registration
  end

  # Below for all other routes:
  devise_for :users

  ...
end

Now in your views, for the registration:

<%= link_to "Sign up", new_user_registration_path %>

No other modifications need. Any issues, you may need to restart your server and that's all. Note you can rename sign_up to register if you like.

Clone this wiki locally