Remove useless code in de_image.rb
This commit is contained in:
		
							parent
							
								
									02e5e52159
								
							
						
					
					
						commit
						1c1839fc00
					
				| 
						 | 
					@ -16,28 +16,12 @@ class AdImage
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  field :post_date,type: Date
 | 
					  field :post_date,type: Date
 | 
				
			||||||
  field :unpost_date,type: Date
 | 
					  field :unpost_date,type: Date
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  field :to_save, :type => Boolean
 | 
					 | 
				
			||||||
  field :to_destroy, :type => Boolean
 | 
					 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  belongs_to :ad_banner
 | 
					  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
 | 
					  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
 | 
					  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?
 | 
					  def display?
 | 
				
			||||||
    if (self.post_date <= Date.today && (self.unpost_date.nil? || self.unpost_date>= Date.today) rescue false) 
 | 
					    if (self.post_date <= Date.today && (self.unpost_date.nil? || self.unpost_date>= Date.today) rescue false) 
 | 
				
			||||||
      return true
 | 
					      return true
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue