Bonjour,

je cherche a modifier les routes de devise,
j'ai fait quelque recherche mais j'ai pas trouver la solution.

si quelqu'un a la reponce ça pourais m'aider.

Merci d'avence

2 réponses


Grafikart
Réponse acceptée

Très simple ^^

  devise_scope :user do
    get 'login',       to: 'devise/sessions#new',      as: 'sign_in'
    get 'inscription', to: 'users#new',                as: 'sign_up'
    get 'logout',      to: 'devise/sessions#destroy',  as: 'sign_out'
    get 'profil/edit', to: 'users#edit',               as: 'user_edit'
    put 'profil/edit', to: 'users#update'
    get 'profil',      to: 'users#profil',             as: 'user_profil'
    get 'premium',     to: 'users#premium',            as: 'premium'
    get 'profil/:id',  to: 'users#show',               as: 'user', constraints: {id: id}
    patch 'mon-compte', to: 'users#update'
  end

Voila le code que j'utilse dans mon routes.rb

norfair
Auteur
Réponse acceptée

Merci,
J'ai trouver aussi.

as :user do
    get 'login' => 'devise/sessions#new', :as => :new_user_session
    post 'login' => 'devise/sessions#create', :as => :user_session
    delete 'logout' => 'devise/sessions#destroy', :as => :destroy_user_session

    get 'register' => 'devise/registrations#new', :as => :new_user_registration
    post 'account' => 'devise/registrations#create', :as => :user_registration
    get 'account/edit' => 'devise/registrations#edit', :as => :edit_user_registration
    get 'account/cancel' => 'devise/registrations#cancel', :as => :cancel_user_registration

    patch 'account' => 'devise/registrations#update'
    put 'account' => 'devise/registrations#update'
    delete 'account' => 'devise/registrations#destroy'
  end