我正在使用设计,对控制器进行了一些更改,并定义了以下路径。
devise_for :users, skip: [:registrations, :sessions]
devise_scope :user do
resource :registration,
only: [:new, :create, :edit, :update],
path: 'users',
path_names: { new: 'sign-up' },
controller: 'registrations',
as: :user_registration do
get :cancel
end
get 'sign-in' => 'devise/sessions#new', :as => :new_user_session
post 'sign-in' => 'devise/sessions#create', :as => :user_session
delete 'sign-out' => 'devise/sessions#destroy', :as => :destroy_user_session
get "sign-up" => "registrations#new", :as => :new_user_registration
end
导致以下重复路线:
new_user_registration GET /users/sign-up(.:format) registrations#new
new_user_registration GET /sign-up(.:format) registrations#new
如何清理路径文件,确保不会发生复制。
答案 0 :(得分:1)
不确定,postet作为格式的答案:
我认为冗余来自这里:
devise_scope :用户 资源:注册, 仅:[:new ,:create,:edit,:update], 路径:'用户', path_names: new:'注册' ,
这就是
new_user_registration GET /users/sign-up(.:format) registrations#new
和
get "sign-up" => "registrations#new", :as => :new_user_registration
添加
new_user_registration GET /sign-up(.:format) registrations#new
所以留下其中一个