Sha256: 1ef0e98d409e394b2bc6c0a1f4d0fe57eb95871cf755e3cabc23d1f115b9327b
Contents?: true
Size: 729 Bytes
Versions: 7
Compression:
Stored size: 729 Bytes
Contents
class MembershipType < ActiveRecord::Base attr_accessible :name, :price, :fee, :number_of_shows, :plan, :on_sale, :description, :ends_at, :starts_at belongs_to :organization has_many :memberships has_many :members, :through => :memberships belongs_to :segment after_create :create_list_segment default_scope order("created_at DESC") scope :on_sale, where(:on_sale => true) def membershipize self.name.end_with?("Membership") ? self.name : self.name + " Membership" end def create_list_segment @search = organization.searches.create({:membership_type => self}) @segment = organization.segments.create({:search => @search, :name => self.name}) self.segment = @segment save end end
Version data entries
7 entries across 7 versions & 1 rubygems