Agreed, and by "running all validations" you can have a certain validator that acts as a state machine on a set of validations that gives more meaningful errors as the state moves forward. I think most of us have done that in the past to get the behavior you are looking for. Changing core behavior for that case does not make sense.
- Ken On Jun 21, 2012, at 9:07 AM, Carlos Antonio da Silva wrote: > I agree with Steve, when we call valid?, we expect all validations to run. If > you want to skip some validation in case errors already exist in the object > for any particular reason, you can always to that as you said: `if > errors.empty?`. This will give you the behavior you expect, although I'd > recommend avoiding this and running all validations. > > -- > At. > Carlos Antonio > > On Thursday, June 21, 2012 at 9:51 AM, Steve Klabnik wrote: > >> I think I'd be much more annoyed by this kind of behavior. "Okay, >> these two things are wrong. Let's fix them. Wait, now it's _still_ >> wrong, with something totally unrelated?" >> >> You could fix this case almost trivially by 'if age.to_i < 16', right? >> I mean, I know you're talking about a more general case, but... >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Core" 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-core?hl=en. > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" 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-core?hl=en. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" 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-core?hl=en.
