One of my models contains a virtual attribute called things. This attribute is an array, and I'd like every element within that array to be validated against a set of rules. Here is my current attempt at validation:
validates :things, presence: true, length: { minimum: 2, maximum: 255 }
The problem with this code is that it validates the entire array itself, not each individual element within the array. I know I can write a custom validator, but is there any way to use the existing validation options to run these validations against every element in the array? The other topics I found on this are for older versions of Rails, so I'm not sure if Rails 4 has something new that could help with this.
Thanks in advance for any help!