class BlogsController < ApplicationController def summary @blogs = Blog.where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10) if not params[:page] @main_page = true end end def index @blogs = Blog.where(published: true).order(published_at: :desc) respond_to do |format| format.html format.atom end end def show @blog = Blog.find_by_slug(params[:slug]) raise ActiveRecord::RecordNotFound unless @blog raise ActiveRecord::RecordNotFound unless @blog.published end end