Class: Comfy::Blog::PostsController
- Inherits:
-
Cms::BaseController
- Object
- Cms::BaseController
- Comfy::Blog::PostsController
- Includes:
- Paginate
- Defined in:
- app/controllers/comfy/blog/posts_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
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 |
#show ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'app/controllers/comfy/blog/posts_controller.rb', line 23 def show load_post render layout: app_layout rescue ActiveRecord::RecordNotFound render cms_page: "/404", status: 404 end |