uninitialized constant Authlogic::Session::Validation

114 Views Asked by At

I'm upgrading a rails 4.2 site to 6.0 and am receiving

uninitialized constant Authlogic::Session::Validation

when I try to load a form, presumably because the Validation module was removed from Authlogic and some old gem/code is still trying to reference it. If I use the authenticity_token=false option for form_with, it goes away, but obviously I don't want to do that.

So, somewhere, somehow something is referencing this old module. Here's the rub:

  1. I've searched my entire code base for "Authlogic::Session::Validation". Nothing.
  2. I've searched my entire gem tree for "Authlogic::Session::Validation". Nothing.

It's like it is configured as a plug-in for generating form authenticity tokens or something, but I'm at a loss for where that configuration would be or how to find it. I mean, for that error, that string has to be somewhere, right?

Here's the relevant part (my code is in moments.haml) of the callstack when I get my error:

Application Trace | Framework Trace | Full Trace 
activesupport (6.0.2.2) lib/active_support/inflector/methods.rb:284:in `const_get' 
activesupport (6.0.2.2) lib/active_support/inflector/methods.rb:284:in `block in constantize' 
activesupport (6.0.2.2) lib/active_support/inflector/methods.rb:280:in `each' 
activesupport (6.0.2.2) lib/active_support/inflector/methods.rb:280:in `inject' 
activesupport (6.0.2.2) lib/active_support/inflector/methods.rb:280:in `constantize' 
activesupport (6.0.2.2) lib/active_support/core_ext/string/inflections.rb:68:in `constantize' 
activesupport (6.0.2.2) lib/active_support/core_ext/marshal.rb:10:in `rescue in load' 
activesupport (6.0.2.2) lib/active_support/core_ext/marshal.rb:5:in `load' 
activerecord-session_store (1.1.3) lib/active_record/session_store.rb:63:in `load' 
activerecord-session_store (1.1.3) lib/active_record/session_store.rb:20:in `deserialize' 
activerecord-session_store (1.1.3) lib/active_record/session_store/session.rb:71:in `data' 
activerecord-session_store (1.1.3) lib/action_dispatch/session/active_record_store.rb:141:in `find_session' 
rack (2.2.2) lib/rack/session/abstract/id.rb:314:in `load_session' 
actionpack (6.0.2.2) lib/action_dispatch/middleware/session/abstract_store.rb:46:in `block in load_session' 
actionpack (6.0.2.2) lib/action_dispatch/middleware/session/abstract_store.rb:54:in `stale_session_check!' 
actionpack (6.0.2.2) lib/action_dispatch/middleware/session/abstract_store.rb:46:in `load_session' 
actionpack (6.0.2.2) lib/action_dispatch/request/session.rb:235:in `load!' 
actionpack (6.0.2.2) lib/action_dispatch/request/session.rb:231:in `load_for_write!' 
actionpack (6.0.2.2) lib/action_dispatch/request/session.rb:132:in `[]=' 
actionpack (6.0.2.2) lib/action_controller/metal/request_forgery_protection.rb:397:in `real_csrf_token' 
actionpack (6.0.2.2) lib/action_controller/metal/request_forgery_protection.rb:327:in `masked_authenticity_token' 
actionpack (6.0.2.2) lib/action_controller/metal/request_forgery_protection.rb:314:in `form_authenticity_token' 
actionpack (6.0.2.2) lib/abstract_controller/helpers.rb:67:in `form_authenticity_token' 
actionview (6.0.2.2) lib/action_view/helpers/url_helper.rb:622:in `token_tag' 
actionview (6.0.2.2) lib/action_view/helpers/form_tag_helper.rb:863:in `extra_tags_for_form' 
actionview (6.0.2.2) lib/action_view/helpers/form_tag_helper.rb:883:in `form_tag_html' 
actionview (6.0.2.2) lib/action_view/helpers/form_tag_helper.rb:888:in `form_tag_with_body' 
actionview (6.0.2.2) lib/action_view/helpers/form_helper.rb:759:in `form_with' 
app/views/layouts/moments.haml:264 

EDIT: I was getting the same error when I was setting the csrf-token meta-tag when calling form_authenticity_token (which is referenced in the above callstack). I forgot I had commented that out in an attempt to debug.

1

There are 1 best solutions below

0
On

Tracked down that the reference was coming from an error being stored in my user's session data. Cleared the session database with rake:db:sessions:clear and it went away.