Sha256: 299ce3d058f461be469979428d14af3e8e77c13301c60892a4cd6c66ab378763
Contents?: true
Size: 556 Bytes
Versions: 28
Compression:
Stored size: 556 Bytes
Contents
class NewsItem < ActiveRecord::Base validates_presence_of :title, :content has_friendly_id :title, :use_slug => true, :strip_diacritics => true acts_as_indexed :fields => [:title, :body] 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 content self.body end def content=(value) self.body = value end end
Version data entries
28 entries across 28 versions & 1 rubygems