Reputation: 797
I have updates my route.rb
like:-
devise_for :authorizes
devise_scope :authorizes do
get '/alogin' => 'devise/sessions#new'
get '/alogout' => 'devise/sessions#destroy'
end
devise_for :hrs
devise_scope :hrs do
get '/hlogin' => 'devise/sessions#new'
get '/hlogout' => 'devise/sessions#destroy'
end
devise_for :employes
devise_scope :employes do
get '/elogin' => 'devise/sessions#new'
get '/elogout' => 'devise/sessions#destroy'
end
ERROR
Could not find devise mapping for path "/alogin". 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]`
Upvotes: 0
Views: 154
Reputation: 1748
When you use devise_scope
, you should use singular for your model, i.e. :authorize
(not :authorizes
)
Just try the following code:
devise_for :authorizes
devise_scope :authorize do
get '/alogin' => 'devise/sessions#new'
get '/alogout' => 'devise/sessions#destroy'
end
devise_for :hrs
devise_scope :hr do
get '/hlogin' => 'devise/sessions#new'
get '/hlogout' => 'devise/sessions#destroy'
end
devise_for :employes
devise_scope :employe do
get '/elogin' => 'devise/sessions#new'
get '/elogout' => 'devise/sessions#destroy'
end
Upvotes: 1