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.



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

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

#membership_category_idsObject



54
55
56
# File 'app/models/effective/membership_history.rb', line 54

def membership_category_ids
  membership_categories.map(&:id)
end

#membership_category_ids=(ids) ⇒ Object



58
59
60
61
# File 'app/models/effective/membership_history.rb', line 58

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_idsObject



63
64
65
# File 'app/models/effective/membership_history.rb', line 63

def membership_status_ids
  membership_statuses.map(&:id)
end

#membership_status_ids=(ids) ⇒ Object



67
68
69
70
# File 'app/models/effective/membership_history.rb', line 67

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_statusesObject



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

def membership_statuses
  status_ids.present? ? EffectiveMemberships.Status.where(id: status_ids) : []
end

#to_sObject



40
41
42
# File 'app/models/effective/membership_history.rb', line 40

def to_s
  'membership history'
end