From 2bc5363a0c9f0d697a8c153690b8f713b9ecfd9c Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 7 Dec 2024 16:47:50 -0500 Subject: Add modern filter for top quotes --- app/controllers/quotes_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/quotes_controller.rb b/app/controllers/quotes_controller.rb index af1cfcc..d4800cb 100644 --- a/app/controllers/quotes_controller.rb +++ b/app/controllers/quotes_controller.rb @@ -19,7 +19,9 @@ class QuotesController < ApplicationController end def top - @quotes = Quote.published.order(Arel.sql("(upvotes - downvotes) DESC, id ASC")).paginate(page: params[:page], per_page: 10) + @quotes = Quote.published + @quotes = @quotes.where("created_at > ?", Time.new(2015,1,1)) if params[:modern] + @quotes = @quotes.order(Arel.sql("(upvotes - downvotes) DESC, id ASC")).paginate(page: params[:page], per_page: 10) respond_to do |format| format.html { render :list } -- cgit 1.4.1