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

Version Path
refinerycms-0.9.5.13 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.12 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.11 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.10 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.9 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.8 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.7 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.6 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.5 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.4 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.3 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.2 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.1 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.4.5 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.4.4 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.4.3 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.4.2 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.4.1 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.4 vendor/plugins/news/app/models/news_item.rb