class Session < ActiveRecord::Base belongs_to :location has_many :schedules has_many :programs, :through => :schedules validates_presence_of :name, :start_date, :end_date, :location_id def self.current_session Session.find(:first, :conditions => ['end_date > ?', Time.now()], :order => :start_date) end end