siddick/siddick

View on GitHub
app/controllers/posts_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
class PostsController < ApplicationController
  caches_page :index, :show

  def index
    @posts  = Post.published.includes(:tags).page(params[:page])
    @posts  = @posts.tagged_with(params[:tag]) if params[:tag].present?
    @title  = params[:tag].try(:humanize) || "Home"
  end

  def show
    @post = Post.find(params[:id])
  end
end