This project is archived and is in readonly mode.

#6755 new

Rails 3: errors[:key_without_errors] returns empty array

Reported by weexpectedthis | April 28th, 2011 @ 11:39 PM

There is no reason for this to return an array instead of nil. Makes testing for errors on the object non-intuitive.

With rails 2 in Rspec I can write:

obj.errors.on(:key_without_errors).should be_nil

With rails 3 in Rspec I have to write the weird notation of:

obj.errors[:key_without_errors].to_a.should be_nil

Can we just return nil instead of an empty array?

No comments found

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=""></a>

People watching this ticket