This project is archived and is in readonly mode.

Improved AR::Errors API to get to the Error objects
Reported by Lawrence Pit | September 11th, 2009 @ 07:20 AM
Currently the only way to get to the raw Error objects if via model.errors.each_error. This patch provides a nicer API for the usual cases where you just want to check the presence of a specific error.
In addition, the testsuite didn't have a test that tested that errors.on would return an array of messages. This patch also adds tests for that.
Comments and changes to this ticket
- 
            
         Lawrence Pit September 11th, 2009 @ 07:25 AMwhere you just want to check the presence of a specific error. what I mean is, in my specs I'd like to do: model.error_on(:title).type.should == :invalid model.error_on(:salary).type.should == :too_lowPS. having +type+ as an attr_accessor of the Error object is not helpful.. but that's another ticket. 
- 
            
         Lawrence Pit September 24th, 2009 @ 12:41 PM- Assigned user cleared.
 
- 
            
         Lawrence Pit September 24th, 2009 @ 12:48 PM- Tag changed from 2-3-stable, active_record, i18n to 2-3-stable, active_record, i18n, patch
 
- 
         Rohit Arondekar October 6th, 2010 @ 06:43 AM- State changed from new to stale
- Importance changed from  to 
 Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches. 
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>
 Jeremy Kemper
      Jeremy Kemper
 Rohit Arondekar
      Rohit Arondekar
 Sven Fuchs
      Sven Fuchs