On Sun, Jul 25, 2010 at 5:17 PM, badnaam <[email protected]> wrote:
> I am trying to do a very basic zipcode validation
** (zip is a int field in mysql) **

>  validates_format_of :zip, :with => /^[0-9]{5}(-[0-9]{4})?$/

Uh, you're trying to use a regular expression on an int? Off the top
of my head that seems unlikely to work...

> 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!

.. as the above would seem to confirm.

HTH,
-- 
Hassan Schroeder ------------------------ [email protected]
twitter: @hassan

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

Reply via email to