From 27482983496cd0b8b6fa7dc943a1b05959735835 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Fri, 13 Oct 2023 12:16:18 -0400 Subject: Nice pagination! --- app/controllers/blogs_controller.rb | 3 +++ app/controllers/tags_controller.rb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'app/controllers') 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 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 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 @@ class TagsController < ApplicationController def show + @tag_name = params[:name] @blogs = Blog.tagged_with(params[:name]).where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10) - render "blogs/summary" end def suggest -- cgit 1.4.1