diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-13 12:16:18 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-13 12:16:18 -0400 |
commit | 27482983496cd0b8b6fa7dc943a1b05959735835 (patch) | |
tree | bc63dd51607917101d11e3ab8547808173885023 /app/controllers | |
parent | 0333f3e258026696af265f777f862e612bab1bd7 (diff) | |
download | thoughts-27482983496cd0b8b6fa7dc943a1b05959735835.tar.gz thoughts-27482983496cd0b8b6fa7dc943a1b05959735835.tar.bz2 thoughts-27482983496cd0b8b6fa7dc943a1b05959735835.zip |
Nice pagination!
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/blogs_controller.rb | 3 | ||||
-rw-r--r-- | app/controllers/tags_controller.rb | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb index c35a05d..39a578a 100644 --- a/app/controllers/blogs_controller.rb +++ b/app/controllers/blogs_controller.rb | |||
@@ -2,6 +2,9 @@ class BlogsController < ApplicationController | |||
2 | 2 | ||
3 | def summary | 3 | def summary |
4 | @blogs = Blog.where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10) | 4 | @blogs = Blog.where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10) |
5 | if not params[:page] | ||
6 | @main_page = true | ||
7 | end | ||
5 | end | 8 | end |
6 | 9 | ||
7 | def index | 10 | def index |
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index cf5d50b..bceb3cf 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb | |||
@@ -1,8 +1,8 @@ | |||
1 | class TagsController < ApplicationController | 1 | class TagsController < ApplicationController |
2 | 2 | ||
3 | def show | 3 | def show |
4 | @tag_name = params[:name] | ||
4 | @blogs = Blog.tagged_with(params[:name]).where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10) | 5 | @blogs = Blog.tagged_with(params[:name]).where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10) |
5 | render "blogs/summary" | ||
6 | end | 6 | end |
7 | 7 | ||
8 | def suggest | 8 | def suggest |