Skip to content

Commit

Permalink
Fix bug in AR integration
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredbeck authored and devonestes committed May 9, 2016
1 parent 99ccfd7 commit 4495e88
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 4 additions & 0 deletions lib/paper_trail.rb
Expand Up @@ -176,6 +176,10 @@ def version
end
end

ActiveSupport.on_load(:active_record) do
include PaperTrail::Model
end

# Require frameworks
require "paper_trail/frameworks/sinatra"
if defined?(::Rails) && ActiveRecord::VERSION::STRING >= "3.2"
Expand Down
4 changes: 0 additions & 4 deletions lib/paper_trail/frameworks/active_record.rb
Expand Up @@ -2,7 +2,3 @@
# since otherwise the model(s) will get loaded in via the `Rails::Engine`.
require "paper_trail/frameworks/active_record/models/paper_trail/version_association"
require "paper_trail/frameworks/active_record/models/paper_trail/version"

ActiveSupport.on_load(:active_record) do
include PaperTrail::Model
end
1 change: 0 additions & 1 deletion lib/paper_trail/frameworks/rails/engine.rb
Expand Up @@ -5,7 +5,6 @@ class Engine < ::Rails::Engine
paths["app/models"] << "lib/paper_trail/frameworks/active_record/models"
config.paper_trail = ActiveSupport::OrderedOptions.new
initializer "paper_trail.initialisation" do |app|
ActiveRecord::Base.send :include, PaperTrail::Model
PaperTrail.enabled = app.config.paper_trail.fetch(:enabled, true)
end
end
Expand Down

0 comments on commit 4495e88

Please sign in to comment.