Sha256: b615141f6b635aa7c141b2cefad7972f762cad3be1c5c24ae54b6b45553cfa79

Contents?: true

Size: 722 Bytes

Versions: 1

Compression:

Stored size: 722 Bytes

Contents

class PassType < ActiveRecord::Base
  belongs_to :organization
  has_many :passes

  attr_accessible :name, :description, :hide_fee, :thanks_copy, :sales_start_at, :sales_end_at, 
                  :on_sale, :price, :tickets_allowed, :starts_at, :ends_at

  validates :name, :description, :price, :tickets_allowed, :presence => true

  scope :storefront, where(:on_sale => true).where("sales_start_at < ? or sales_start_at is null", DateTime.now).where("sales_end_at > ? or sales_end_at is null", DateTime.now)
  scope :on_sale, where(:on_sale => true)
  scope :not_ended, where('ends_at > ?', DateTime.now)

  SERVICE_FEE = 0.05

  def passerize
    self.name.end_with?("Pass") ? self.name : self.name + " Pass"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
artfully_ose-1.2.0.pre.23 app/models/pass_type.rb