1
0
Fork 0
mirror of https://github.com/paper-trail-gem/paper_trail.git synced 2022-11-09 11:33:19 -05:00

Fix test suite crashes stemming from 9542529 on Travis

This commit is contained in:
Ben Atkins 2015-01-20 16:07:33 -05:00
parent 41101cf9cd
commit 09a45080d2

View file

@ -7,13 +7,17 @@ module PaperTrail
included do
belongs_to :item, :polymorphic => true
if PaperTrail::VersionAssociation.table_exists?
# Need to inspect inside of a Proc so that tests pass even when DB is not initialized
# such as when we run on Travis (there won't be a db in `test/dummy/db/`)
if lambda { PaperTrail::VersionAssociation.table_exists? }
has_many :version_associations, :dependent => :destroy
end
validates_presence_of :event
attr_accessible :item_type, :item_id, :event, :whodunnit, :object, :object_changes, :transaction_id, :created_at if PaperTrail.active_record_protected_attributes?
if PaperTrail.active_record_protected_attributes?
attr_accessible :item_type, :item_id, :event, :whodunnit, :object, :object_changes, :transaction_id, :created_at
end
after_create :enforce_version_limit!