From 53df1ff3a4f551a71640e5fc956131d469cb6a2a Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 16 Jun 2021 18:09:52 +0800 Subject: [PATCH] Change sort to use event_date. --- app/models/event_news.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/event_news.rb b/app/models/event_news.rb index e7f187a..47b443b 100644 --- a/app/models/event_news.rb +++ b/app/models/event_news.rb @@ -65,7 +65,7 @@ class EventNews before_destroy :destroy_email - scope :can_display_and_sorted, ->{where(:is_hidden=>false,:is_preview => false).any_of({:postdate.lte=>Time.now, :deadline.gte=>Time.now},{:postdate.lte=>Time.now, :deadline=>nil}).order(is_top: :desc,postdate: :desc,id: :desc)} + scope :can_display_and_sorted, ->{where(:is_hidden=>false,:is_preview => false).any_of({:postdate.lte=>Time.now, :deadline.gte=>Time.now},{:postdate.lte=>Time.now, :deadline=>nil}).order(is_top: :desc,event_date: :desc,id: :desc)} scope :is_approved, ->{where(:approved => true)} before_create :set_expire