app/models/effective/log.rb in effective_logging-1.10.0 vs app/models/effective/log.rb in effective_logging-1.10.1
- old
+ new
@@ -11,11 +11,16 @@
belongs_to :parent, class_name: 'Effective::Log', counter_cache: true
has_many :logs, class_name: 'Effective::Log', foreign_key: :parent_id
# The user this log item is referring to
# An associated object, if we wanna add anything extra
- belongs_to :user, optional: true
- belongs_to :associated, polymorphic: true, optional: true
+ if Gem::Version.new(Rails.version) < Gem::Version.new('5.0')
+ belongs_to :user
+ belongs_to :associated, polymorphic: true
+ else
+ belongs_to :user, optional: true
+ belongs_to :associated, polymorphic: true, optional: true
+ end
serialize :details, Hash
# Attributes
# logs_count :integer # Rails Counter Cache