Module: Groupify::Mongoid::GroupMember::ClassMethods
- Defined in:
- lib/groupify/adapter/mongoid/group_member.rb
Instance Method Summary collapse
- #in_all_groups(*groups) ⇒ Object
- #in_any_group(*groups) ⇒ Object
- #in_group(group) ⇒ Object
- #in_only_groups(*groups) ⇒ Object
- #shares_any_group(other) ⇒ Object
Instance Method Details
#in_all_groups(*groups) ⇒ Object
114 115 116 |
# File 'lib/groupify/adapter/mongoid/group_member.rb', line 114 def in_all_groups(*groups) groups.present? ? where(:group_ids.all => groups.flatten.map(&:id)) : none end |
#in_any_group(*groups) ⇒ Object
110 111 112 |
# File 'lib/groupify/adapter/mongoid/group_member.rb', line 110 def in_any_group(*groups) groups.present? ? self.in(group_ids: groups.flatten.map(&:id)) : none end |
#in_group(group) ⇒ Object
106 107 108 |
# File 'lib/groupify/adapter/mongoid/group_member.rb', line 106 def in_group(group) group.present? ? self.in(group_ids: group.id) : none end |
#in_only_groups(*groups) ⇒ Object
118 119 120 |
# File 'lib/groupify/adapter/mongoid/group_member.rb', line 118 def in_only_groups(*groups) groups.present? ? where(:group_ids => groups.flatten.map(&:id)) : none end |
#shares_any_group(other) ⇒ Object
122 123 124 |
# File 'lib/groupify/adapter/mongoid/group_member.rb', line 122 def shares_any_group(other) in_any_group(other.groups.to_a) end |