Hello-

I'm trying to do something pretty basic - validate a form field
against a regex. Here's the line of my model that adds the validation:

validates_format_of :zipcode, :with => /\d{5}(-\d{4})?/, :message =>
'is failing the regex'

When I enter the value "12345" into the form field, it comes back and
tells me that "Zipcode is failing the regex". What's odd is that I've
gotten sporadic success, where the validations will pass - sometimes
with values that failed previously.

I feel confident of the regex itself and testing it in IRB yields the
results I would expect. Once I use it in the validation, then it stops
working.

Does anyone know what might be going on? Failing that, any ideas for
where to start troubleshooting this would be appreciated.

Regards,
Eric
--~--~---------~--~----~------------~-------~--~----~
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@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