Ruby on rails 两种设计模型,具有关联性问题
我有两个设计模型。客户和工程师 客户属于工程师。在“工程师展示”页面中,我试图链接到客户机,但发现一个设计映射错误Ruby on rails 两种设计模型,具有关联性问题,ruby-on-rails,devise,Ruby On Rails,Devise,我有两个设计模型。客户和工程师 客户属于工程师。在“工程师展示”页面中,我试图链接到客户机,但发现一个设计映射错误 Could not find devise mapping for path "/clients/10". 我有两个控制器,一个用于设计,一个用于常规(控制器/客户端/注册控制器和控制器/客户端控制器) 我的路由文件如下所示 devise_for :clients, :controllers => {:registrations => "client/regist
Could not find devise mapping for path "/clients/10".
我有两个控制器,一个用于设计,一个用于常规(控制器/客户端/注册控制器和控制器/客户端控制器)
我的路由文件如下所示
devise_for :clients, :controllers => {:registrations => "client/registrations"}
resources :clients, :only => [:show, :new, :create]
devise_for :engineers, :controllers => {:registrations => "engineer/registrations"}
resources :engineers, :only => [:show]
devise_scope :client do
get "clients/:id", to: "clients#show"
end
资源:客户端是否与范围声明竞争
为了更好地测量我的耙路线:
new_client_session GET /clients/sign_in(.:format) devise/sessions#new
client_session POST /clients/sign_in(.:format) devise/sessions#create
destroy_client_session DELETE /clients/sign_out(.:format) devise/sessions#destroy
client_password POST /clients/password(.:format) devise/passwords#create
new_client_password GET /clients/password/new(.:format) devise/passwords#new
edit_client_password GET /clients/password/edit(.:format) devise/passwords#edit
PATCH /clients/password(.:format) devise/passwords#update
PUT /clients/password(.:format) devise/passwords#update
cancel_client_registration GET /clients/cancel(.:format) client/registrations#cancel
client_registration POST /clients(.:format) client/registrations#create
new_client_registration GET /clients/sign_up(.:format) client/registrations#new
edit_client_registration GET /clients/edit(.:format) client/registrations#edit
PATCH /clients(.:format) client/registrations#update
PUT /clients(.:format) client/registrations#update
DELETE /clients(.:format) client/registrations#destroy
clients POST /clients(.:format) clients#create
new_client GET /clients/new(.:format) clients#new
client GET /clients/:id(.:format) clients#show
new_engineer_session GET /engineers/sign_in(.:format) devise/sessions#new
engineer_session POST /engineers/sign_in(.:format) devise/sessions#create
destroy_engineer_session DELETE /engineers/sign_out(.:format) devise/sessions#destroy
engineer_password POST /engineers/password(.:format) devise/passwords#create
new_engineer_password GET /engineers/password/new(.:format) devise/passwords#new
edit_engineer_password GET /engineers/password/edit(.:format) devise/passwords#edit
PATCH /engineers/password(.:format) devise/passwords#update
PUT /engineers/password(.:format) devise/passwords#update
engineer GET /engineers/:id(.:format) engineers#show
GET /clients/:id(.:format) clients#show
root GET / pages#home
pages_clients GET /pages/clients(.:format) pages#clients
pages_engineers GET /pages/engineers(.:format) pages#engineers
我很确定您应该删除
design\u scope
块,因为您有以下行:
resources :clients, :only => [:show, :new, :create]
这行已经为您提供了客户端路径
:
client GET /clients/:id(.:format) clients#show
但您的设计范围
提供了一个重复(但未命名)路径:
因此,您的routes文件应该如下所示:
devise_for :clients, :controllers => {:registrations => "client/registrations"}
resources :clients, :only => [:show, :new, :create]
devise_for :engineers, :controllers => {:registrations => "engineer/registrations"}
resources :engineers, :only => [:show]
是的,谢谢。加上我使用了错误的控制器继承。。。傻我没问题!我很高兴能帮上忙。
devise_for :clients, :controllers => {:registrations => "client/registrations"}
resources :clients, :only => [:show, :new, :create]
devise_for :engineers, :controllers => {:registrations => "engineer/registrations"}
resources :engineers, :only => [:show]