You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
glasses618
changed the title
The configured before options for the "paper_trail" initializer are not being set correctly.
The configured before options for the "paper_trail" initializer are not being set correctly
Aug 28, 2023
glasses618
changed the title
The configured before options for the "paper_trail" initializer are not being set correctly
The "paper_trail" initializer is not guaranteed to execute before the "load_config_initializers" initializer
Aug 28, 2023
This issue has been automatically marked as stale due to inactivity.
The resources of our volunteers are limited.
Bug reports must provide a script that reproduces the bug, using our template. Feature suggestions must include a promise to build the feature yourself.
Thank you for all your contributions.
Summary
The name of load_config_initializers which is used for registering "paper_trail" initializer's before-initializer should be
:load_config_initializers
instead of'load_config_initializers'
. Please refer to https://github.com/rails/rails/blob/3668b4b5978822f1e6311c7fd7a32f58daee136a/railties/lib/rails/engine.rb#L618.paper_trail/lib/paper_trail/frameworks/rails/railtie.rb
Line 13 in d627260
Reproduce script
tsort_each_child
of initializers ofload_config_initializers
should contain'paper_trail'
initializer.P.S. The original template cannot be utilized to reproduce this issue, so I've prepared an alternative script.
Script
gem 'paper_trail', '15.0.0'
intoGemfile
and runbundle install
rails console
, run the following script:expected result
=> [true, true, true, true, true, true, true, true, true]
Actual result
=> [false, false, false, false, false, false, false, false, false]
Fix
gem 'paper_trail', '15.0.0'
withgem 'paper_trail', github: 'glasses618/paper_trail', branch: 'master'
can fix the problem.Environment
Rails version
7.0.7.2
Ruby version
3.2.2
paper_trail version
15.0.0
Related rails source codes
Rails::Initializable::Collection#tsort_each_child
can be found here: https://github.com/rails/rails/blob/3668b4b5978822f1e6311c7fd7a32f58daee136a/railties/lib/rails/initializable.rb#L50The text was updated successfully, but these errors were encountered: