Sha256: 6000bade6eb2d79358dfe16478c7d01d4325ba9496ea5c462920c1a74820552d
Contents?: true
Size: 814 Bytes
Versions: 2
Compression:
Stored size: 814 Bytes
Contents
class MembershipType < ActiveRecord::Base attr_accessible :name, :price, :fee, :number_of_shows, :plan, :on_sale, :description, :ends_at, :starts_at, :duration, :type, :period, :number_of_tickets 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
artfully_ose-1.2.0.pre.9 | app/models/membership_type.rb |
artfully_ose-1.2.0.pre.8 | app/models/membership_type.rb |