module Groupify::Mongoid::NamedGroupMember::ClassMethods

Public Instance Methods

in_all_named_groups(*named_groups) click to toggle source
# File lib/groupify/adapter/mongoid/named_group_member.rb, line 71
def in_all_named_groups(*named_groups)
  named_groups.flatten!
  return none unless named_groups.present?

  where(:named_groups.all => named_groups.flatten)
end
in_any_named_group(*named_groups) click to toggle source
# File lib/groupify/adapter/mongoid/named_group_member.rb, line 64
def in_any_named_group(*named_groups)
  named_groups.flatten!
  return none unless named_groups.present?

  self.in(named_groups: named_groups.flatten)
end
in_named_group(named_group, opts={}) click to toggle source
# File lib/groupify/adapter/mongoid/named_group_member.rb, line 60
def in_named_group(named_group, opts={})
  in_any_named_group(named_group, opts)
end
in_only_named_groups(*named_groups) click to toggle source
# File lib/groupify/adapter/mongoid/named_group_member.rb, line 78
def in_only_named_groups(*named_groups)
  named_groups.flatten!
  return none unless named_groups.present?

  where(named_groups: named_groups.flatten)
end
shares_any_named_group(other, opts={}) click to toggle source
# File lib/groupify/adapter/mongoid/named_group_member.rb, line 85
def shares_any_named_group(other, opts={})
  in_any_named_group(other.named_groups, opts)
end