diff --git a/lib/activity_notification/orm/mongoid/notification.rb b/lib/activity_notification/orm/mongoid/notification.rb index ad0df64f..e6a67051 100644 --- a/lib/activity_notification/orm/mongoid/notification.rb +++ b/lib/activity_notification/orm/mongoid/notification.rb @@ -140,7 +140,9 @@ class Notification scope :filtered_by_group, ->(group) { group.present? ? where(group_id: group.id, group_type: group.class.name) : - any_of({ :group_id.exists => false, :group_type.exists => false }, { group_id: nil, group_type: nil }) + Gem::Version.new(::Mongoid::VERSION) >= Gem::Version.new('7.1.0') ? + where(:group_id.exists => false, :group_type.exists => false).or(group_id: nil, group_type: nil) : + any_of({ :group_id.exists => false, :group_type.exists => false }, { group_id: nil, group_type: nil }) } # Selects filtered notifications later than specified time.