Module: GroupMixins::Guests
- Extended by:
- ActiveSupport::Concern
- Included in:
- Group
- Defined in:
- app/models/group_mixins/guests.rb
Overview
All groups have associated special groups, for example the ‘guests_parent` group, which contains all guests of the group.
This mixin provides the accessor methods for the guests_parent special group.
The mechanism used in the mixin is defined in ‘StructureableMixins::HasSpecialGroups`.
Instance Method Summary collapse
- #create_guests_parent_group ⇒ Object
- #find_guest_users ⇒ Object
-
#find_guests_groups ⇒ Object
This method lists all guest subgroups of self, but not of the subgroups of self.
-
#find_guests_parent_group ⇒ Object
Guests ==========================================================================================.
- #find_or_create_guests_parent_group ⇒ Object
- #guests ⇒ Object
- #guests_parent ⇒ Object
- #guests_parent! ⇒ Object
Instance Method Details
#create_guests_parent_group ⇒ Object
25 26 27 |
# File 'app/models/group_mixins/guests.rb', line 25 def create_guests_parent_group create_special_group(:guests_parent) end |
#find_guest_users ⇒ Object
41 42 43 |
# File 'app/models/group_mixins/guests.rb', line 41 def find_guest_users guests_parent.descendant_users end |
#find_guests_groups ⇒ Object
This method lists all guest subgroups of self, but not of the subgroups of self. This is used, for example, if there are several kinds of guests.
my_group
|---------- guests_parent
|----------- regular_guests <-- returned by this
|----------- vip_guests <-- method.
57 58 59 |
# File 'app/models/group_mixins/guests.rb', line 57 def find_guests_groups find_guests_parent_group.descendant_groups end |
#find_guests_parent_group ⇒ Object
Guests
21 22 23 |
# File 'app/models/group_mixins/guests.rb', line 21 def find_guests_parent_group find_special_group(:guests_parent) end |
#find_or_create_guests_parent_group ⇒ Object
29 30 31 |
# File 'app/models/group_mixins/guests.rb', line 29 def find_or_create_guests_parent_group find_or_create_special_group(:guests_parent) end |
#guests ⇒ Object
45 46 47 |
# File 'app/models/group_mixins/guests.rb', line 45 def guests find_guest_users end |
#guests_parent ⇒ Object
33 34 35 |
# File 'app/models/group_mixins/guests.rb', line 33 def guests_parent find_or_create_guests_parent_group end |
#guests_parent! ⇒ Object
37 38 39 |
# File 'app/models/group_mixins/guests.rb', line 37 def guests_parent! find_guests_parent_group || raise('special group :guests_parent does not exist.') end |