Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 7th, 2012  |  syntax: None  |  size: 0.22 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. validate :check_date_validity
  2.  
  3.   def check_date_validity
  4.   date_submitted = Date.strptime("#{self.year}/#{self.month}/#{self.day}" , "%Y/%m/%d")
  5.   errors.add(:birthday, "does not look right") if date_submitted == nil
  6.   end