about summary refs log tree commit diff stats
path: root/app/controllers/blogs_controller.rb
blob: c35a05d47273269361f027ebb15ba70bd10ce7a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class BlogsController < ApplicationController

  def summary
    @blogs = Blog.where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10)
  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