diff --git a/app/models/ad_image.rb b/app/models/ad_image.rb index 129042f..07c815d 100644 --- a/app/models/ad_image.rb +++ b/app/models/ad_image.rb @@ -25,9 +25,9 @@ class AdImage belongs_to :banner - before_validation :add_http + before_save :add_http # validates :file, presence: true - validates :out_link, format: {:with=> /\A(http:\/\/|https:\/\/|\/)/i}, 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.unscoped.or({:postdate.lte=>Time.now},{:postdate=>nil}).selector,AdImage.unscoped.or({:deadline.gte=>Time.now},{:deadline=>nil}).selector)} @@ -126,7 +126,7 @@ class AdImage def add_http unless self.out_link.blank? || self.out_link[/^http:\/\//] || self.out_link[/^https:\/\//] || self.out_link[/^\//] - self.out_link = 'http://' + self.out_link + self.out_link = 'https://' + self.out_link end end end