Sorcery breaks Rails defaults from initializers for ActiveRecord #312
Labels
bug
Something isn't working
implemented in v1
This issue or pull request has been resolved in the v1 rework codebase
We are working on upgrading a Rails 5 app and the Rails 5.2 update adds
new_framework_defaults_5_2.rb
with:# Rails.application.config.active_record.cache_versioning = true
When that is commented, cache keys look like this:
When it is uncommented, it changes the output to this:
When I add sorcery to the project, though, the cache key reverts to the former version.
If I comment sorcery out in the Gemfile, then the cache key is the correct value again.
I have created a reproduction app, with exact reproduction instructions in the readme, here.
I believe this is happening because sorcery loads ActiveRecord too early. I debugged similar issues with recaptcha and wicked_pdf for ApplicationController.
You can see how recaptcha fixed it by converting to using a railtie here.
You can see how wicked_pdf fixed it the same way here.
I realize sorcery supports frameworks other than Rails, but I'm hoping that a Rails check can be used to fix this. If the application is a Rails application, then load using
ActiveSupport.on_load
. Otherwise, load as it currently does. I saw thatengine.rb
references needing to do this forActionController
too, but there are issues for pre-existing code.I'd be happy to create a PR, but I'm not sure about the issues that pre-existing code was experiencing.
Configuration
master
2.6.10
Rails 5.2
, presumably up tomain
branchMacOS
Expected Behavior
Rails initializers for ActiveRecord should work.
Actual Behavior
They do not necessarily work
Steps to Reproduce
Please see https://github.com/brandoncc/sorcery-error-reproduction-rails-app.
The text was updated successfully, but these errors were encountered: