-
Notifications
You must be signed in to change notification settings - Fork 901
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
PaperTrail.enabled now affects all threads, again #720
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,11 @@ module PaperTrail | |
module Rails | ||
class Engine < ::Rails::Engine | ||
paths['app/models'] << 'lib/paper_trail/frameworks/active_record/models' | ||
config.paper_trail = ActiveSupport::OrderedOptions.new | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain how this works? I never understood what is supposed to go in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
initializer 'paper_trail.initialisation' do |app| | ||
ActiveRecord::Base.send :include, PaperTrail::Model | ||
PaperTrail.enabled = app.config.paper_trail.fetch(:enabled, true) | ||
end | ||
end | ||
end | ||
end |
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.
I think this needs to remain within
lib/paper_trail.rb
because this file only conditionally gets loaded whenActiveRecord
is utilized outside of the context of rails. Or perhaps there should be anlib/paper_trail/frameworks/active_model.rb
. Regardless not sure it belongs as part of this PR, seems unrelated. Happy to make a PR for that piece separately if you'd like.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.
Oh I see now that you also added a similar block inside of the
Rails::Engine
. Did this have issues too related to thread safety?