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)}