This project is archived and is in readonly mode.

#4356 ✓resolved
Mathieu Arnold

model.errors.empty? broken

Reported by Mathieu Arnold | April 9th, 2010 @ 12:05 PM

In the rails 2.3 docs, we can see in the ActiveRecord::Errors documentation :

empty?()
Returns true if no errors have been added.

Which is quite nice to have, but now, there's a regression, with rails 3 :

> model.errors
=> #<OrderedHash {}>
> model.errors.empty?
=> true
> model.errors.on :id
=> nil
> model.errors 
=> #<OrderedHash {:id=>[]}>
> model.errors.empty?
=> false

It's all right until I call errors.on something, then the hash is not empty any more, and empty? does not do the right thing.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Referenced by

Pages