我在我的设计控制器中添加动作时遇到了一些麻烦。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.
我的代码有什么问题?