From 6d3683a98fdb6d89d3d63e1caef10e9075fd46d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Mon, 24 Jan 2022 10:32:12 +0800 Subject: [PATCH] fix error --- app/models/ad_image.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/ad_image.rb b/app/models/ad_image.rb index 041e304..18ef018 100644 --- a/app/models/ad_image.rb +++ b/app/models/ad_image.rb @@ -27,7 +27,7 @@ class AdImage before_validation :add_http # 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 scope :can_display, ->{self.and(AdImage.or({:postdate.lte=>Time.now},{:postdate=>nil}).selector,AdImage.or({:deadline.gte=>Time.now},{:deadline=>nil}).selector)}