class Auction < ActiveRecord::Base has_many :images, :as => :object def to_param "#{id}-#{name.gsub(/[^a-z0-9]+/i, '-').downcase}" end def self.upcoming find(:all, :conditions => ["datetime >= ?", Time.now], :order => :datetime) end end