Class: BlogPostsController

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

Instance Method Summary collapse

Instance Method Details

#categoryObject

get /blog_posts/:category_slug



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

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

#indexObject

get /blog_posts



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

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

#showObject

get /blog_posts/:post_id-:post_slug



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

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