-
Notifications
You must be signed in to change notification settings - Fork 899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix lazy-loading of ActiveRecord #1281
Conversation
An effort begun by Eric Proulx in #1237 - Replaces Engine with simpler Railtie - Critically, defers certain `requires` - With Rails, defers via a Lazy Load Hook in the Railtie - Without Rails, just by require-ing AR first
- Ensure that the "paper_trail" initializer happens before the end-user's initializers (in their app's config/initializers) - Document the boot process of dummy_app and how it differs from a conventional app. This is a direct continuation of fc6c5f6, which was a collaboration between Eric and myself, but I choose to make this a separate commit, partly for vanity, and partly on the faint hope that it might make review easier.
Hopefully this will prevent people from trying to add rails-controller-testing to our gemspec.
5b8c5c0
to
5cb5c80
Compare
I was able to make this explicit by adding the following: - initializer "paper_trail" do
+ initializer "paper_trail", before: "load_config_initializers" do Incidentally, to my delight, it seems that Rails initializers are not a simple queue, but rather a directed, acyclic graph. See the
It's difficult to test these changes with our # Gemfile
gem 'paper_trail', github: 'paper-trail-gem/paper_trail', branch: 'jb_lazy_load_rails' I have tested this branch in this way, and it'd be great if at least one other person could too. So, I think this is ready for final review. @ericproulx of course, and who else? @seanlinsley ? @batter ? |
Our next release will most likely be a major version, 12, because |
I can help test this locally |
Thanks Todd, how'd it go? |
Sorry @jaredbeck, I should have mentioned I was planning on testing this weekend |
Hi @jaredbeck, this looks good to me. Tested:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thank you @ericproulx for writing the heart of this, and @tlynam for testing. I'll release this shortly as 12.0.0. |
Superesedes #1237, preserving Eric Proulx' authorship.
I've fixed some of my own concerns from #1237, but two remain:
config/initializers/paper_trail.rb
. The documentation encourages this. I assume we want the end-user's initializer to happen last? If so, is there a way to make that explicit in code?