From ffcc44d1a73ae1191e835fa625f2f8a7e3e25bda Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 11 Oct 2023 10:31:33 -0400 Subject: Blogs list is now main page (with pagination) --- app/controllers/blogs_controller.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'app/controllers/blogs_controller.rb') 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 @@ class BlogsController < ApplicationController + def index + @blogs = Blog.where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10) + + respond_to do |format| + format.html + format.atom + end + end + def show @blog = Blog.find_by_slug(params[:slug]) -- cgit 1.4.1