diff --git a/lib/activity_notification/orm/active_record/notification.rb b/lib/activity_notification/orm/active_record/notification.rb index ba73b52..68596bd 100644 --- a/lib/activity_notification/orm/active_record/notification.rb +++ b/lib/activity_notification/orm/active_record/notification.rb @@ -45,11 +45,13 @@ class Notification < ::ActiveRecord::Base belongs_to :notifier, polymorphic: true, optional: true # Serialize parameters Hash + # :nocov: if Rails.gem_version >= Gem::Version.new('7.1') serialize :parameters, type: Hash, coder: YAML else serialize :parameters, Hash end + # :nocov: validates :target, presence: true validates :notifiable, presence: true diff --git a/lib/activity_notification/orm/active_record/subscription.rb b/lib/activity_notification/orm/active_record/subscription.rb index efa0ff4..72046fb 100644 --- a/lib/activity_notification/orm/active_record/subscription.rb +++ b/lib/activity_notification/orm/active_record/subscription.rb @@ -14,11 +14,13 @@ class Subscription < ::ActiveRecord::Base belongs_to :target, polymorphic: true # Serialize parameters Hash + # :nocov: if Rails.gem_version >= Gem::Version.new('7.1') serialize :optional_targets, type: Hash, coder: YAML else serialize :optional_targets, Hash end + # :nocov: validates :target, presence: true validates :key, presence: true, uniqueness: { scope: :target }