Class: Effective::MembershipHistory
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Effective::MembershipHistory
- Defined in:
- app/models/effective/membership_history.rb
Instance Method Summary collapse
- #end_period ⇒ Object
-
#membership_categories ⇒ Object
These two accessors are for the memberships history form.
- #membership_category_ids ⇒ Object
- #membership_category_ids=(ids) ⇒ Object
- #membership_status_ids ⇒ Object
- #membership_status_ids=(ids) ⇒ Object
- #membership_statuses ⇒ Object
-
#reportable_scopes ⇒ Object
effective_reports.
- #start_period ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#end_period ⇒ Object
90 91 92 |
# File 'app/models/effective/membership_history.rb', line 90 def end_period EffectiveMemberships.Registrar.period(date: end_on) end |
#membership_categories ⇒ Object
These two accessors are for the memberships history form. But we just assign categories and category_ids directly in registrar.
60 61 62 |
# File 'app/models/effective/membership_history.rb', line 60 def membership_categories category_ids.present? ? EffectiveMemberships.Category.where(id: category_ids) : [] end |
#membership_category_ids ⇒ Object
68 69 70 |
# File 'app/models/effective/membership_history.rb', line 68 def membership_category_ids membership_categories.map(&:id) end |
#membership_category_ids=(ids) ⇒ Object
72 73 74 75 |
# File 'app/models/effective/membership_history.rb', line 72 def membership_category_ids=(ids) categories = EffectiveMemberships.Category.where(id: ids) assign_attributes(categories: categories.map(&:to_s), category_ids: categories.map(&:id)) end |
#membership_status_ids ⇒ Object
77 78 79 |
# File 'app/models/effective/membership_history.rb', line 77 def membership_status_ids membership_statuses.map(&:id) end |
#membership_status_ids=(ids) ⇒ Object
81 82 83 84 |
# File 'app/models/effective/membership_history.rb', line 81 def membership_status_ids=(ids) statuses = EffectiveMemberships.Status.where(id: ids) assign_attributes(statuses: statuses.map(&:to_s), status_ids: statuses.map(&:id)) end |
#membership_statuses ⇒ Object
64 65 66 |
# File 'app/models/effective/membership_history.rb', line 64 def membership_statuses status_ids.present? ? EffectiveMemberships.Status.where(id: status_ids) : [] end |
#reportable_scopes ⇒ Object
effective_reports
36 37 38 |
# File 'app/models/effective/membership_history.rb', line 36 def reportable_scopes { removed: nil, not_removed: nil } end |
#start_period ⇒ Object
86 87 88 |
# File 'app/models/effective/membership_history.rb', line 86 def start_period EffectiveMemberships.Registrar.period(date: start_on) end |
#to_s ⇒ Object
54 55 56 |
# File 'app/models/effective/membership_history.rb', line 54 def to_s model_name.human end |