我在我的设计控制器里加了一个动作有点麻烦。我在文件夹registrations_controller中创建了一个名为users/的控制器,如下所示:
class Users::RegistrationsController < Devise::RegistrationsController这是我的路线文件:
root to: 'home#index'
devise_for :users
devise_scope :users do
get 'users/profil/:id', to: 'users/registrations#profil', as: 'profil'
end我看到了以下错误:
Unknown action
Could not find devise mapping for path "/users/profil/1"
This may happen for two reasons: 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.我的密码怎么了?
发布于 2013-11-12 22:24:30
尝试以下几点:
devise_scope :user do
get 'users/profil/:id', to: 'users/registrations#profil', as: 'profil'
end
devise_for :users, :controllers => {:registrations => "users/registrations"}
resources :users 另外,您不需要将控制器命名为Users::RegistrationsController,将其命名为RegistrationController,保存继承,就像Devise::RegistrationsController一样
https://stackoverflow.com/questions/19941106
复制相似问题