From 1c1839fc0041c23192144cd8461318a7eb0c43d0 Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 9 Jan 2013 21:16:57 +0800 Subject: [PATCH] Remove useless code in de_image.rb --- app/models/ad_image.rb | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/app/models/ad_image.rb b/app/models/ad_image.rb index c01bc6b4..c3260c5e 100644 --- a/app/models/ad_image.rb +++ b/app/models/ad_image.rb @@ -16,28 +16,12 @@ class AdImage field :post_date,type: Date field :unpost_date,type: Date - - field :to_save, :type => Boolean - field :to_destroy, :type => Boolean belongs_to :ad_banner - # validates_numericality_of :weight, greater_than_or_equal_to: 1,less_than_or_equal_to: 10 - # validates_format_of :out_link, with: /(http:\/\/.*|)/ ,:message => 'Need a valid URL' - attr_reader :parse_post_date,:parse_unpost_date - before_validation :add_http 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) - end - - - def parse_unpost_date=(att) - self.unpost_date = (Date.parse att.gsub(/\s+/, "") rescue nil) - end - def display? if (self.post_date <= Date.today && (self.unpost_date.nil? || self.unpost_date>= Date.today) rescue false) return true