Module: RocketCMS::Controllers::News

Extended by:
ActiveSupport::Concern
Included in:
NewsController
Defined in:
lib/rocket_cms/controllers/news.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



6
7
8
9
10
11
12
# File 'lib/rocket_cms/controllers/news.rb', line 6

def index
  @news = model.enabled.after_now.by_date

  unless RocketCMS.config.news_per_page.nil?
    @news = @news.page(params[:page])
  end
end

#showObject



14
15
16
17
18
19
20
21
# File 'lib/rocket_cms/controllers/news.rb', line 14

def show
  @news = model.after_now.find(params[:id])

  if @news and @news.text_slug != params[:id]
    redirect_to @news, status_code: 301
    return true
  end
end