Sha256: 7d6611e10af0030413eaa7aaf10d5466b3548cace74babf9a46ea716dc61fdd1

Contents?: true

Size: 549 Bytes

Versions: 16

Compression:

Stored size: 549 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

16 entries across 16 versions & 1 rubygems

Version Path
refinerycms-0.9.5.29 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.28 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.27 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.26 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.25 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.24 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.23 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.22 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.21 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.20 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.19 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.18 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.17 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.16 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.15 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.14 vendor/plugins/news/app/models/news_item.rb