Sha256: e749f25d6a1e98d335a62d4946cfd022577d42dddaa0d3a063a77334d637b82a
Contents?: true
Size: 572 Bytes
Versions: 5
Compression:
Stored size: 572 Bytes
Contents
class NewsItem < ActiveRecord::Base validates_presence_of :title, :content alias_attribute :content, :body has_friendly_id :title, :use_slug => true acts_as_indexed :fields => [:title, :body], :index_file => [Rails.root.to_s, "tmp", "index"] def self.latest(amount = 10) find(:all, :order => "publish_date DESC", :limit => amount, :conditions => ["publish_date < ?", Time.now]) end 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
5 entries across 5 versions & 1 rubygems