Sha256: d2ba49814d5a7753de96b7ec1cb2adbf1781c6abab60250fe98b55fbd4307136

Contents?: true

Size: 674 Bytes

Versions: 4

Compression:

Stored size: 674 Bytes

Contents

# Models a conference.
# origin: M
class Conference < ActiveRecord::Base
  does 'conference/categories'
  does 'conference/attendance'
  does 'conference/icalendar'
  does 'conference/search'

  belongs_to :user

  validates_presence_of :name, :start_date, :end_date, :description, :address, :user_id

  named_scope :by_name, :order => :name
  named_scope :running, lambda {{ :conditions => ['start_date <= ? AND ? <= end_date', Date.today, Date.today] }}

  has_attachment :logo

  validate do |record|
    if record.start_date and record.end_date and record.start_date > record.end_date
      record.errors.add :end_date, 'must be after the start date'
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
serum-rails-0.2.1 spec/test_apps/rails-2-3/app/models/conference.rb
serum-rails-0.2.0 spec/test_apps/rails-2-3/app/models/conference.rb
serum-rails-0.1.1 spec/test_app/app/models/conference.rb
serum-rails-0.1.0 spec/test_app/app/models/conference.rb