fix error

This commit is contained in:
chiu 2022-08-04 08:43:30 +00:00
parent ac2c08767f
commit 0474d206f6
1 changed files with 3 additions and 3 deletions

View File

@ -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