Skip to content
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 bug in AR integration #794

Merged
merged 1 commit into from
May 4, 2016
Merged

Fix bug in AR integration #794

merged 1 commit into from
May 4, 2016

Conversation

jaredbeck
Copy link
Member

[Fixes #789]

@jaredbeck
Copy link
Member Author

Reverts the part of 2029ea3 which appears to cause issue #789

I would prefer if users were required to manually include PaperTrail::Model in each of their models, but that's a whole 'nother discussion..

@jaredbeck
Copy link
Member Author

on_load is explained in activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb as follows:

# lazy_load_hooks allows Rails to lazily load a lot of components and thus
# making the app boot faster. Because of this feature now there is no need to
# require <tt>ActiveRecord::Base</tt> at boot time purely to apply
# configuration. Instead a hook is registered that applies configuration once
# <tt>ActiveRecord::Base</tt> is loaded. Here <tt>ActiveRecord::Base</tt> is
# used as example but this feature can be applied elsewhere too.
#
# Here is an example where +on_load+ method is called to register a hook.
#
#   initializer 'active_record.initialize_timezone' do
#     ActiveSupport.on_load(:active_record) do
#       self.time_zone_aware_attributes = true
#       self.default_timezone = :utc
#     end
#   end
#
# When the entirety of +activerecord/lib/active_record/base.rb+ has been
# evaluated then +run_load_hooks+ is invoked. The very last line of
# +activerecord/lib/active_record/base.rb+ is:
#
#   ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base)

@jaredbeck jaredbeck merged commit 75348c3 into master May 4, 2016
@jaredbeck jaredbeck deleted the fix_issue_789 branch May 4, 2016 18:19
@batter
Copy link
Collaborator

batter commented May 4, 2016

I would prefer if users were required to manually include PaperTrail::Model in each of their models, but that's a whole 'nother discussion..

Agreed that would be ideal, as it does seem a bit excessive including it on every ActiveRecord instance in a project where the gem is being used. Maybe we can shoot for that for PaperTrail 6?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants