こんにちは。現在deviseで現在detailを新たに構築しようと考えております。
route設定で
routes
1Rails.application.routes.draw do 2 3 devise_for :managements, :controllers => { 4 :registrations => 'managements/registrations', 5 :sessions => 'managements/sessions' 6 } 7 devise_scope :managements do 8 get "managements/:id", :to => "managements/registrations#detail" 9 end 10 11 devise_for :users, :controllers => { 12 :registrations => 'users/registrations', 13 :sessions => 'users/sessions' 14 } 15 devise_scope :users do 16 get "users/:id", :to => "users/registrations#detail" 17 end
と設定しており、結果としてログイン後のリダイレクト先として
managementscontroller
1 def detail 2 @management = Management.find_by(id: params[:id]) 3 end 4 5 def after_inactive_sign_up_path_for(resource) 6 "/managements/#{current_management.id}" 7 end
としておりますが、以下のエラーが発生しております。
エラー内容
http://localhost:3000/managements/1
Could not find devise mapping for path "/managements/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. If so, you can explicitly tell Devise which mapping to use: @request.env["devise.mapping"] = Devise.mappings[:user]
エラーに対する理由がわからずご教示頂けないでしょうか?
よろしくお願い致します。
あなたの回答
tips
プレビュー