Class: Effective::Committee
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Effective::Committee
- Defined in:
- app/models/effective/committee.rb
Instance Method Summary collapse
-
#build_committee_member(user:) ⇒ Object
Find or build.
- #committee_member(user:) ⇒ Object
- #to_s ⇒ Object
- #users ⇒ Object
Instance Method Details
#build_committee_member(user:) ⇒ Object
Find or build
46 47 48 |
# File 'app/models/effective/committee.rb', line 46 def build_committee_member(user:) committee_member(user: user) || committee_members.build(user: user) end |
#committee_member(user:) ⇒ Object
41 42 43 |
# File 'app/models/effective/committee.rb', line 41 def committee_member(user:) committee_members.find { |member| member.user_id == user.id } end |
#to_s ⇒ Object
37 38 39 |
# File 'app/models/effective/committee.rb', line 37 def to_s title.presence || 'New Committee' end |
#users ⇒ Object
50 51 52 |
# File 'app/models/effective/committee.rb', line 50 def users committee_members.reject(&:marked_for_destruction?).map(&:user) end |