Ruby on Rails & Devise, change 'users/sign_in' to 'sign-in' using omniauth_callbacks and registrations

devise, routes, ruby-on-rails

Solution

You need to tell Devise to skip session ULRs.

devise_for :users :controllers => { :registrations => 'registrations', :omniauth_callbacks => "authentications" }, :skip => [:sessions]

devise_scope :user do
    put 'update_plan', :to => 'registrations#update_plan'
    put 'update_card', :to => 'registrations#update_card'
    put 'charge', :to => 'registrations#charge'

    get "/sign-up"   => "users/registrations#new",   :as => :new_user_registration
    get '/sign-in'   => "devise/sessions#new",       :as => :new_user_session
    post '/sign-in'  => 'devise/sessions#create',    :as => :user_session
    get '/sign-out'  => 'devise/sessions#destroy',   :as => :destroy_user_session 
end

See How To: Change the default sign_in and sign_out routes

Problem

I am trying to change the 'users/sign_in' to 'sign-in' route This is my current route setup ``` devise_for :users, :controllers => { :registrations => 'registrations', :omniauth_callbacks => "authentications" } devise_scope :user do put 'update_plan', :to => 'registrations#update_plan' put 'update_card', :to => 'registrations#update_card' put 'charge', :to => 'registrations#charge' get "/sign-up" => "users/registrations#new", :as => :new_user_registration get '/sign-in' => "devise/sessions#new", :as => :new_user_session post '/sign-in' => 'devise/sessions#create', :as => :user_session get '/sign-out' => 'devise/sessions#destroy', :as => :destroy_user_session end ``` but these routes give me the error `ArgumentError: Invalid route name, already in use: 'new_user_registration'` can I move the `:controllers => { :registrations => 'registrations', :omniauth_callbacks => "authentications" }` bit into devise_scope? If i remove `:as => :new_user_registration` from my routes then i get a redirect loop. I really can't figure this out Any help is much appreciated thanks.

Original source