Class: Effective::MembershipHistory

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/effective/membership_history.rb

Instance Method Summary collapse

Instance Method Details

#membership_categoriesObject

These two accessors are for the memberships history form. But we just assign categories and category_ids directly in registrar.



43
44
45
# File 'app/models/effective/membership_history.rb', line 43

def membership_categories
  category_ids.present? ? EffectiveMemberships.Category.where(id: category_ids) : []
end

#membership_category_idsObject



47
48
49
# File 'app/models/effective/membership_history.rb', line 47

def membership_category_ids
  membership_categories.map(&:id)
end

#membership_category_ids=(ids) ⇒ Object



51
52
53
54
# File 'app/models/effective/membership_history.rb', line 51

def membership_category_ids=(ids)
  categories = EffectiveMemberships.Category.where(id: ids)
  assign_attributes(categories: categories.map(&:to_s), category_ids: categories.map(&:id))
end

#to_sObject



37
38
39
# File 'app/models/effective/membership_history.rb', line 37

def to_s
  'membership history'
end