The ValidationErrors class doesn't actually have a #size method definition, it's just method_missing-passed to the internal Dictionary of errors when you call the #size method.
If you take a look at the ValidationErrors class, it has a #full_messages method, which collects all errors in to a single list, which you can then call #size on. Also, @errors.values.flatten.size should give you what you want as well. -J On Thu, Mar 18, 2010 at 12:12 PM, maguiar <[email protected]> wrote: > Hello all. sorry for my poor google-translated-english. > > if a model has 2 validation errors in the same property, > model.errors.size gives me 1 intead of 2. > In other words, the current implementation of ValidationErrors.size > does not give how many errors the model have(which is what i > expected), but how many *invalid propertys* the model have. > This is the intended behavior or it's a bug ? > > thanks, > > Marcio > > -- > You received this message because you are subscribed to the Google Groups > "DataMapper" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<datamapper%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/datamapper?hl=en. > > -- You received this message because you are subscribed to the Google Groups "DataMapper" 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/datamapper?hl=en.
