Hey everyone,
Whats the best way to nest model validations so multple errors relating to the same field appear one by one, rather than all at once? I was talking with some people on IRC the other day, but two of the ideas I got appear to be things that would be nice to have in RoR, but arn’t right now (the ability to add blocks or if statments, like follows)
validates_presence_of :email do validates_format_of :email, :with => /[1]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}$/ end
OR
if validates_presence_of :email validates_format_of :email, :with => /[2]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}$/ end
Neither of these work however, and rather than going into lots of :if => and functions checking if other variables are set and such, I was wondering if anyone knew or a gem, plugin, or RoR function to assit with this. Your help is much appreciated.