Fix for banner link

This commit is contained in:
Christophe Vilayphiou committed 2012-08-13 11:03:11 +08:00
1 parent 33fc96ac7c
commit 2ea3193879
3 files changed
+12 -8

No files matched your search

+2 -2
View File
@@ -27,7 +27,7 @@ class AdImage
attr_reader :parse_post_date,:parse_unpost_date
before_validation :add_http
validates :out_link, :presence => true, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix
validates :out_link, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix, :allow_blank => true
def parse_post_date=(att)
self.post_date = (Date.parse att.gsub(/\s+/, "") rescue nil)
@@ -59,7 +59,7 @@ class AdImage
protected
def add_http
unless self.out_link[/^http:\/\//] || self.out_link[/^https:\/\//]
unless self.out_link[/^http:\/\//] || self.out_link[/^https:\/\//] || self.out_link.blank?
self.out_link = 'http://' + self.out_link
end
end