diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/blogs_controller.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb index 8ee472e..eda1bbb 100644 --- a/app/controllers/blogs_controller.rb +++ b/app/controllers/blogs_controller.rb | |||
@@ -1,5 +1,14 @@ | |||
1 | class BlogsController < ApplicationController | 1 | class BlogsController < ApplicationController |
2 | 2 | ||
3 | def index | ||
4 | @blogs = Blog.where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10) | ||
5 | |||
6 | respond_to do |format| | ||
7 | format.html | ||
8 | format.atom | ||
9 | end | ||
10 | end | ||
11 | |||
3 | def show | 12 | def show |
4 | @blog = Blog.find_by_slug(params[:slug]) | 13 | @blog = Blog.find_by_slug(params[:slug]) |
5 | 14 | ||