0
我在routes.rb中找不到设计映射路径
devise_for :users, controllers: { registrations: "network/registrations",sessions: 'network/sessions', passwords: 'network/passwords' }
devise_scope :user do
get "registrations/show" => "network/registrations", as: :show_user_profile
end
定义了以下路线,当我做耙路线我也看到
network_show_user_profile GET /network/registrations/show(.:format) network/registrations#show
但是,当我试图访问路径/网络/注册/节目
我得到下面的异常
找不到设计映射路径“/ network/registrations/show”。 可能发生这种情况的原因有两个:
1) You forgot to wrap your route inside the scope block. For example:
devise_scope :user do
get "/some/route" => "some_devise_controller"
end
2) You are testing a Devise controller bypassing the router.
If so, you can explicitly tell Devise which mapping to use:
@request.env["devise.mapping"] = Devise.mappings[:user]
我试图修改routes.rb中,并加入
devise_scope :user do
get 'user_profile' => 'registrations#search', :as => 'user_profile'
end
,当我访问user_profile路,我得到的错误
The action 'show' could not be found for Network::RegistrationsController
但当我添加动作显示到控制器我再次得到相同的异常消息
无法找到路径“/ network/registrations/show”的设计映射。 可能发生这种情况的原因有两个:
1) You forgot to wrap your route inside the scope block. For example:
devise_scope :user do
get "/some/route" => "some_devise_controller"
end
2) You are testing a Devise controller bypassing the router.
If so, you can explicitly tell Devise which mapping to use:
@request.env["devise.mapping"] = Devise.mappings[:user]
任何帮助,以什么我做错了,将不胜感激。谢谢。
嗨nimish,仍然是同样的错误。 –
@ opensource-developer请参阅最新的答案 –
嗨@nimish再次为您的答复。但它仍然给我同样的错误,不知道我在做什么错误 –