How to customize (Rails) Devise routes ending with 'new', 'edit', and so on?

Here it is the devise part of my config/route.rb :

devise_for :admin_utilisateurs, :path_names => { :sign_up => 'enregistrer',
                                                 :sign_in => 'connexion',
                                                 :sign_out => 'deconnexion',
                                                 :password => 'mot_de_passe',
                                                 :unlock => 'deverouiller'},
                                :path => 'identification'

This result in the following rake routes :

        new_admin_utilisateur_session GET    /identification/connexion(.:format)             devise/sessions#new
            admin_utilisateur_session POST   /identification/connexion(.:format)             devise/sessions#create
    destroy_admin_utilisateur_session DELETE /identification/deconnexion(.:format)           devise/sessions#destroy
           admin_utilisateur_password POST   /identification/mot_de_passe(.:format)          devise/passwords#create
       new_admin_utilisateur_password GET    /identification/mot_de_passe/new(.:format)      devise/passwords#new
      edit_admin_utilisateur_password GET    /identification/mot_de_passe/edit(.:format)     devise/passwords#edit
                                      PUT    /identification/mot_de_passe(.:format)          devise/passwords#update
cancel_admin_utilisateur_registration GET    /identification/cancel(.:format)                devise/registrations#cancel
       admin_utilisateur_registration POST   /identification(.:format)                       devise/registrations#create
   new_admin_utilisateur_registration GET    /identification/enregistrer(.:format)           devise/registrations#new
  edit_admin_utilisateur_registration GET    /identification/edit(.:format)                  devise/registrations#edit
                                      PUT    /identification(.:format)                       devise/registrations#update
                                      DELETE /identification(.:format)                       devise/registrations#destroy
       admin_utilisateur_confirmation POST   /identification/confirmation(.:format)          devise/confirmations#create
   new_admin_utilisateur_confirmation GET    /identification/confirmation/new(.:format)      devise/confirmations#new
                                      GET    /identification/confirmation(.:format)          devise/confirmations#show
             admin_utilisateur_unlock POST   /identification/deverouiller(.:format)          devise/unlocks#create
         new_admin_utilisateur_unlock GET    /identification/deverouiller/new(.:format)      devise/unlocks#new
                                      GET    /identification/deverouiller(.:format)          devise/unlocks#show

How can I change ?, for instance, the route :




If I add :new => 'nouveau' into the :path_names hash, that does'nt work.

Many thanks for help


Looks like rails-translate-routes gem could help with this. Check out the I18n Routes section in this blogpost by Fabio Akita : Minimal I18n with Rails 3.2 for details about how to use the gem - in conjunction with devise - to translate to full URL to native languages.

One solution which does not require using an additional gem consists in using a scope with a path_names option:

scope path_names: { new: 'creer', edit: 'modifier' } do

   devise_for :users


See for more information.

Need Your Help

Android Studio 2.2 Databinding error

android android-studio gradle data-binding android-gradle

I've just updated Android Studio to 2.2, Gradle plugin to 2.2.0 and I am getting the following error in the project when initializing views using DataBinding. It says Type T has incompatible upper ...