Sha256: b02368eb1a67f354a9704642e38c9794dc8316b714b63d92d8de9f07dd551b49
Contents?: true
Size: 588 Bytes
Versions: 4
Compression:
Stored size: 588 Bytes
Contents
class NewsItem < ActiveRecord::Base validates_presence_of :title, :body, :publish_date has_friendly_id :title, :use_slug => true acts_as_indexed :fields => [:title, :body], :index_file => [Rails.root.to_s, "tmp", "index"] default_scope :order => "publish_date DESC" named_scope :latest, :conditions => ["publish_date < ?", Time.now], :limit => 10 named_scope :published, :conditions => ["publish_date < ?", Time.now] def not_published? # has the published date not yet arrived? publish_date > Time.now end def self.per_page 20 end end
Version data entries
4 entries across 4 versions & 1 rubygems