From 0474d206f69b15b8c9e2034025d90d812f0efce1 Mon Sep 17 00:00:00 2001 From: chiu Date: Thu, 4 Aug 2022 08:43:30 +0000 Subject: [PATCH] fix error --- app/models/ad_image.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/ad_image.rb b/app/models/ad_image.rb index 18ef018..a7c73fa 100644 --- a/app/models/ad_image.rb +++ b/app/models/ad_image.rb @@ -30,9 +30,9 @@ class AdImage validates :out_link, format: {:with=> /\A(http:\/\/|https:\/\/|\/)/i}, allow_blank: true # validates :title, presence: true - scope :can_display, ->{self.and(AdImage.or({:postdate.lte=>Time.now},{:postdate=>nil}).selector,AdImage.or({:deadline.gte=>Time.now},{:deadline=>nil}).selector)} - scope :is_expired, ->{self.and(AdImage.or({:deadline.lte=>Time.now}).selector)} - scope :not_expired, ->{self.and(AdImage.or({:deadline.gte=>Time.now},{:deadline=>nil}).selector)} + scope :can_display, ->{self.and(AdImage.unscoped.or({:postdate.lte=>Time.now},{:postdate=>nil}).selector,AdImage.unscoped.or({:deadline.gte=>Time.now},{:deadline=>nil}).selector)} + scope :is_expired, ->{self.and(AdImage.unscoped.or({:deadline.lte=>Time.now}).selector)} + scope :not_expired, ->{self.and(AdImage.unscoped.or({:deadline.gte=>Time.now},{:deadline=>nil}).selector)} after_save do if (self.video_file_changed? || self.auto_convert_video_changed?) && self.auto_convert_video