Module: EffectiveOrganizationsOrganization
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/effective_organizations_organization.rb
Overview
EffectiveOrganizationsOrganization
Mark your category model with effective_organizations_organization to get all the includes
Defined Under Namespace
Modules: Base, ClassMethods
Instance Method Summary collapse
-
#build_representative(user:) ⇒ Object
Find or build.
-
#representative(user:) ⇒ Object
Instance Methods.
- #users ⇒ Object
Instance Method Details
#build_representative(user:) ⇒ Object
Find or build
62 63 64 |
# File 'app/models/concerns/effective_organizations_organization.rb', line 62 def build_representative(user:) representative(user: user) || representatives.build(user: user) end |
#representative(user:) ⇒ Object
Instance Methods
57 58 59 |
# File 'app/models/concerns/effective_organizations_organization.rb', line 57 def representative(user:) representatives.find { |rep| rep.user_id == user.id } end |
#users ⇒ Object
66 67 68 |
# File 'app/models/concerns/effective_organizations_organization.rb', line 66 def users representatives.reject(&:marked_for_destruction?).map(&:user) end |