Can someone tell me why this returns ''dob is invalid'' when dob
is
''01/01/1969''?
validates_format_of :dob, :with => /[0-9]{2}.[0-9]{2}.[0-9]
{4}/, :message => ''is invalid''
I''m trying to validate a date entred into a form. I suppose there are
different ways to accomplish this, and because it doesn''t work,
I''m
going to be using them, but this seems like a basic format that should
work.
irb gives me this:
>> "01/01/2007" =~ /[0-9]{2}.[0-9]{2}.[0-9]{4}/
=> 0
>> "01/01/2007" =~ %r{[0-9]{2}/[0-9]{2}/[0-9]{4}}
=> 0
>> "01/01/2007" =~ %r{^[0-9]{2}/[0-9]{2}/[0-9]{4}$}
=> 0
none of these combinations work in validates_format_of.
Ideas? Things to try?
Mike B.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---