plataformatec/devise — Issue #1693: NoMethodError (protected method `_prefixes') while upgrading to Devise 2.0
Author: dgilperez
Created: 2012-03-02 22:16:40+00:00
State: open

Hi !

I was trying to upgrade my app to Devise 2.0 from 1.5.2. I followed the instructions and restarted the server. I'm running rails 3.2.0 and ruby 1.9.2-p290. Everything was running fine before.

My setup includes a custom ``SessionsController`` like this:

````
class SessionsController < Devise::SessionsController
# override devise login form to store the return_to URL
def new
store_referer unless (request.referer =~ /password/)
super
end
end
````

That ``store_referer``method is in ``ApplicationController`` and looks like this:

`````
# Store referer to be able to return to it later, for example
# after successful feedback or login,
# only if the referer is from the same server
def store_referer
session[:return_to] = request.referer if request.get? && request.referer && request.referer.starts_with?(request.protocol + request.host)
end
````

After upgrading, once I login, every request I do requiring authorization exits with this error:

NoMethodError (protected method `_prefixes' called for #)

The full stacktrace:

````
Started POST "/usuarios/entrar" for 127.0.0.1 at 2012-03-02 22:59:24 +0100
Processing by SessionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"EFdQ2NH1PZdTNNDBxcLphRmoHc8E+le8HDvXzP5vrcY=", "user"=>{"email"=>"email@example.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "locale"=>"es"}
(0.2ms) SET PROFILING=1
User Load (0.5ms) SELECT SQL_NO_CACHE `users`.* FROM `users` WHERE `users`.`email` = 'email@example.com' LIMIT 1
(0.3ms) BEGIN
[paperclip] Saving attachments.
(0.2ms) COMMIT
(0.1ms) BEGIN
(0.5ms) UPDATE `users` SET `last_sign_in_at` = '2012-03-01 20:39:40', `current_sign_in_at` = '2012-03-02 21:59:25', `current_sign_in_ip` = '127.0.0.1', `sign_in_count` = 412, `updated_at` = '2012-03-02 21:59:25' WHERE `users`.`id` = 23
[paperclip] Saving attachments.
(0.7ms) COMMIT
(0.1ms) BEGIN
(0.4ms) UPDATE `users` SET `last_request_at` = '2012-03-02 21:59:25', `updated_at` = '2012-03-02 21:59:25' WHERE `users`.`id` = 23
[paperclip] Saving attachments.
(0.4ms) COMMIT
Redirected to http://localhost:3000/actividad
Completed 302 Found in 537ms (ActiveRecord: 0.0ms)

NoMethodError (protected method `_prefixes' called for #):
config/initializers/robots_middleware.rb:28:in `call'
config/initializers/flash_session_cookie_middleware.rb:16:in `call'

Rendered /Users/dgilperez/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (2.4ms)
Rendered /Users/dgilperez/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.4ms)
Rendered /Users/dgilperez/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (6.9ms)
````

Any ideas will be greatly appreciated!