デバイスコントローラーにアクションを追加する際に問題が発生しました。次のような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.
コードの何が問題になっていますか?