1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Better error message when mapping can't be found

This commit is contained in:
José Valim 2012-06-07 14:34:13 +03:00
parent 985b646ee1
commit 215fdf119e

View file

@ -62,11 +62,19 @@ class DeviseController < Devise.parent_controller.constantize
def assert_is_devise_resource! #:nodoc:
unknown_action! <<-MESSAGE unless devise_mapping
Could not find devise mapping for path #{request.fullpath.inspect}.
Maybe you forgot to wrap your route inside the scope block? For example:
This may happen for two reasons:
1) You forgot to wrap your route inside the scope block. For example:
devise_scope :user do
match "/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]
devise_scope :user do
match "/some/route" => "some_devise_controller"
end
MESSAGE
end