plataformatec/devise — Issue #1678: Error while redirecting after password reset
Author: ddidier
Created: 2012-02-23 22:23:50+00:00
State: open

Hi,
First, I'm quite new with both ruby and rails, so maybe I'm missing something obvious, but...

I'm using devise-2.0.4 with cancan-1.6.7.
When I'm requesting a new password to be sent by email, I got

NoMethodError (undefined method `_with_routes' for nil:NilClass):
actionpack (3.2.1) lib/action_dispatch/routing/routes_proxy.rb:14:in `url_options'
actionpack (3.2.1) lib/action_dispatch/routing/routes_proxy.rb:28:in `new_user_session_path'
actionpack (3.2.1) lib/action_dispatch/routing/routes_proxy.rb:32:in `method_missing'
devise (2.0.4) lib/devise/controllers/url_helpers.rb:50:in `new_session_path'
devise (2.0.4) app/controllers/devise/passwords_controller.rb:44:in `after_sending_reset_password_instructions_path_for'
...

I traced this error :
at `url_helpers.rb:50` is sending a `new_user_session_path` message to `_devise_route_context`
then `url_options` is called but @scope is nil

As a workaround, in ApplicationController :

def new_session_path *args
case args[0]
when :user
new_user_session_path
else
raise "Unsupported scope: #{args[0]}"
end
end

thanks