7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'app/controllers/comfy/blog/posts_controller.rb', line 7
def index
scope =
if params[:year]
scope = @cms_site.blog_posts.published.for_year(params[:year])
params[:month] ? scope.for_month(params[:month]) : scope
else
@cms_site.blog_posts.published
end
scope = scope.for_category(params[:category]) if params[:category]
scope = scope.order(:published_at).reverse_order
@blog_posts = comfy_paginate(scope, per_page: ComfyBlog.config.posts_per_page)
render layout: ComfyBlog.config.app_layout
end
|