fix error

This commit is contained in:
邱博亞 2022-01-24 10:32:12 +08:00
parent c4246c84be
commit 6d3683a98f
1 changed files with 1 additions and 1 deletions

View File

@ -27,7 +27,7 @@ class AdImage
before_validation :add_http before_validation :add_http
# validates :file, presence: true # validates :file, presence: true
validates :out_link, format: { with: URI::regexp(%w(http https \/)) }, allow_blank: true validates :out_link, format: {:with=> /\A(http:\/\/|https:\/\/|\/)/i}, allow_blank: true
# validates :title, presence: 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 :can_display, ->{self.and(AdImage.or({:postdate.lte=>Time.now},{:postdate=>nil}).selector,AdImage.or({:deadline.gte=>Time.now},{:deadline=>nil}).selector)}