Is it possible to use standard Rails validations with a Postgres array? I have a service_area
column which accepts an array of zip codes. It works well enough, though when I try to use validations for numericality and length, the validators throw errors. Input such as 78702, 78704, 78705
gets the error messages is not a number
and is the wrong length
. It appears that Rails is trying to validate them as a string, rather than as an array of five digit zipcodes. Is there some way to inform the validator that it needs to parse the input as an array? Thanks!
Take the 2-minute tour
×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
|
|||
|
Is there something stopping you from converting it to array explicitely like this?
|
|||||||||
|