From 38022023e06fb259c1871821677dd5c3571ddcbe Mon Sep 17 00:00:00 2001 From: BOHUNG Date: Wed, 11 Mar 2020 19:06:45 +0800 Subject: [PATCH] Fix the wrong display order problem in index page when postdate are equal. --- app/models/bulletin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/bulletin.rb b/app/models/bulletin.rb index 82610ef..d60cf52 100644 --- a/app/models/bulletin.rb +++ b/app/models/bulletin.rb @@ -50,7 +50,7 @@ class Bulletin 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)} + 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 :is_approved, ->{where(:approved => true)} before_create :set_expire