Module: EffectiveCommitteesUser
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/effective_committees_user.rb
Overview
EffectiveCommitteesUser
Mark your user model with effective_committees_user to get all the includes
Defined Under Namespace
Modules: Base, ClassMethods
Instance Method Summary collapse
-
#build_committee_member(committee:) ⇒ Object
Find or build.
-
#committee_member(committee:) ⇒ Object
Instance Methods.
- #committees ⇒ Object
Instance Method Details
#build_committee_member(committee:) ⇒ Object
Find or build
32 33 34 |
# File 'app/models/concerns/effective_committees_user.rb', line 32 def build_committee_member(committee:) committee_member(committee: committee) || committee_members.build(committee: committee) end |
#committee_member(committee:) ⇒ Object
Instance Methods
27 28 29 |
# File 'app/models/concerns/effective_committees_user.rb', line 27 def committee_member(committee:) committee_members.find { |rep| rep.committee_id == committee.id } end |
#committees ⇒ Object
36 37 38 |
# File 'app/models/concerns/effective_committees_user.rb', line 36 def committees committee_members.reject(&:marked_for_destruction?).map(&:committee) end |