Displaying 1 result from an estimated 1 matches for "activation_date".
2008 Jun 07
3
DRY validates_format_of?
In a model I have following validates_format_of. Is there an easy way to
DRY this up? It seems to be rather repetitive.
  validates_format_of   :expiration_date, :with        =>
/^[0-9]{4}[-][0-9]{2}[-][0-9]{2}$/
  validates_format_of   :activation_date, :with        =>
/^[0-9]{4}[-][0-9]{2}[-][0-9]{2}$/
  validates_format_of   :some_other_date, :with   =>
/^[0-9]{4}[-][0-9]{2}[-][0-9]{2}$/
....
Thanks
-- 
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are...