about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-12-07 16:47:50 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2024-12-07 16:47:50 -0500
commit2bc5363a0c9f0d697a8c153690b8f713b9ecfd9c (patch)
treecddfa248ff0c719dec413ef7cd92ea50979e13e3
parent222dbaf5c23b41eabb75a83784bd4d110e981547 (diff)
downloadthoughts-2bc5363a0c9f0d697a8c153690b8f713b9ecfd9c.tar.gz
thoughts-2bc5363a0c9f0d697a8c153690b8f713b9ecfd9c.tar.bz2
thoughts-2bc5363a0c9f0d697a8c153690b8f713b9ecfd9c.zip
Add modern filter for top quotes
-rw-r--r--app/controllers/quotes_controller.rb4
1 files changed, 3 insertions, 1 deletions
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
19 end 19 end
20 20
21 def top 21 def top
22 @quotes = Quote.published.order(Arel.sql("(upvotes - downvotes) DESC, id ASC")).paginate(page: params[:page], per_page: 10) 22 @quotes = Quote.published
23 @quotes = @quotes.where("created_at > ?", Time.new(2015,1,1)) if params[:modern]
24 @quotes = @quotes.order(Arel.sql("(upvotes - downvotes) DESC, id ASC")).paginate(page: params[:page], per_page: 10)
23 25
24 respond_to do |format| 26 respond_to do |format|
25 format.html { render :list } 27 format.html { render :list }