Sha256: 6b99c5bb91b93fe9db3bb97da213d9f1da6ff85d63a7b7ce8bcbb63dfcaa7ec8

Contents?: true

Size: 584 Bytes

Versions: 5

Compression:

Stored size: 584 Bytes

Contents

class NewsItem < ActiveRecord::Base

  validates_presence_of :title, :content
  alias_attribute :content, :body

  has_friendly_id :title, :use_slug => true, :strip_diacritics => true

  acts_as_indexed :fields => [:title, :body],
          :index_file => [RAILS_ROOT,"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

Version Path
refinerycms-0.9.6.2 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.6.1 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.6 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.31 vendor/plugins/news/app/models/news_item.rb
refinerycms-0.9.5.30 vendor/plugins/news/app/models/news_item.rb