Class: Foxynews::PressroomsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/foxynews/pressrooms_controller.rb

Instance Method Summary collapse

Instance Method Details

#archiveObject



23
24
25
26
27
# File 'app/controllers/foxynews/pressrooms_controller.rb', line 23

def archive
  page = params[:page] || 1
  @limit = params[:limit] || 30
  @timeline, @next_timeline_page, @next_page = pagination_content(page, @limit)
end

#indexObject



6
7
8
9
10
11
12
13
14
# File 'app/controllers/foxynews/pressrooms_controller.rb', line 6

def index

  feature_id = Foxynews::FeaturedItem.where(featured: true).pluck(:article_id).first
  @press_release = feature_id ? Foxynews::PressReleaseSetter.find(feature_id, 'true') : nil

  page = params[:page] || 1
  @limit = params[:limit] || 30
  @timeline, @next_timeline_page, @next_page = pagination_content(page, @limit)
end

#showObject



17
18
19
20
21
# File 'app/controllers/foxynews/pressrooms_controller.rb', line 17

def show
  unless @press_release = Foxynews::PressReleaseSetter.find(params[:id], 'true')
    redirect_to root_path, flash: { error: I18n.t('error')}
  end
end