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
1 changed files with 6 additions and 2 deletions

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!