diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-11 10:31:33 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-11 10:31:33 -0400 |
commit | ffcc44d1a73ae1191e835fa625f2f8a7e3e25bda (patch) | |
tree | 55e9825d4e7d59cdad345d85ac4adf60607568b9 /app/controllers/blogs_controller.rb | |
parent | 1622895cd467f59f25fe375f081aa59693ae4c8f (diff) | |
download | thoughts-ffcc44d1a73ae1191e835fa625f2f8a7e3e25bda.tar.gz thoughts-ffcc44d1a73ae1191e835fa625f2f8a7e3e25bda.tar.bz2 thoughts-ffcc44d1a73ae1191e835fa625f2f8a7e3e25bda.zip |
Blogs list is now main page (with pagination)
Diffstat (limited to 'app/controllers/blogs_controller.rb')
-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 | ||