Class: ArticlesController

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

Instance Method Summary collapse

Instance Method Details

#categoryObject

get /articles/:category_slug



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

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

#indexObject

get /articles



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

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

#showObject

get /articles/:post_id-:post_slug



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

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