Sha256: caae59f7c62186d83bc864593f0256ccdf629c973885f7a55f28c2554c40fd19

Contents?: true

Size: 614 Bytes

Versions: 4

Compression:

Stored size: 614 Bytes

Contents

class NewsItemsController < ApplicationController

  before_filter :find_latest_news_items, :find_page
  before_filter :find_published_news_items, :find_page, :only => [:index]
  before_filter :find_news_item, :only => [:show]

protected

  def find_latest_news_items
    @news_items = NewsItem.latest.paginate(:page => params[:page]) # 10 items
  end

  def find_published_news_items
    @news_items = NewsItem.published.paginate(:page => params[:page])
  end

  def find_news_item
    @news_item = NewsItem.published.find(params[:id])
  end

  def find_page
    @page = Page.find_by_link_url("/news")
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
refinerycms-news-0.9.9.4 app/controllers/news_items_controller.rb
refinerycms-news-0.9.9.3 app/controllers/news_items_controller.rb
refinerycms-news-0.9.9.2 app/controllers/news_items_controller.rb
refinerycms-news-0.9.9.1 app/controllers/news_items_controller.rb