Class: NewsController

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

Instance Method Summary collapse

Instance Method Details

#categoryObject

get /news/:category_slug



12
13
14
# File 'app/controllers/news_controller.rb', line 12

def category
  @collection = @category.posts.for_language(current_language).page_for_visitors(current_page)
end

#indexObject

get /news



6
7
8
9
# File 'app/controllers/news_controller.rb', line 6

def index
  post_type   = PostType.find_by(slug: 'news')
  @collection = post_type.posts.for_language(current_language).page_for_visitors(current_page)
end

#showObject

get /news/:post_id-:post_slug



17
18
19
# File 'app/controllers/news_controller.rb', line 17

def show
  @entity.increment!(:view_count)
end