Skip to content

Commit

Permalink
Fix mongoid any_of selector error in filtered_by_group scope - MONGOI…
Browse files Browse the repository at this point in the history
…D-4887
  • Loading branch information
simukappu committed Aug 12, 2020
1 parent bba7dfd commit d4792db
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/activity_notification/orm/mongoid/notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d4792db

Please sign in to comment.