I am trying to do a very basic zipcode validation(zip is a int field
in mysql).

 validates_presence_of :zip, :message => "Can't be blank"
 validates_format_of :zip, :with => /^[0-9]{5}(-[0-9]{4})?$/, :message
=> "Invalid Zipcode"

No matter whatever valid 5 digit zip I enter, this does not work, but
If I do a
'12345'.match (/^[0-9]{5}(-[0-9]{4})?$/) it works just fine!


-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to