This project is archived and is in readonly mode.
ActiveRecord::Base#has_errors?
Reported by RSL | April 23rd, 2008 @ 01:48 AM
I really hate typing unless @foo.errors.blank? when I really mean if @user.has_errors? and thought this might make a good patch on Rails. Calling #invalid? actually clears the errors and redoes the validation which isn't the behavior I want here. I just want to know that the object has errors.
I didn't add tests because it seems a really simple patch and it would probably require mocha to assert that the validations don't get run. I'm completely open to writing tests if need be though.
Comments and changes to this ticket
-
josh April 27th, 2008 @ 06:32 PM
- State changed from new to invalid
We are actually moving in the opposite direction, Errors will soon become more hash like. So #invalid? will be replaced by errors.any?.
-
Jeff Kreeftmeijer November 7th, 2010 @ 04:52 PM
- Tag cleared.
- Importance changed from to Low
Automatic cleanup of spam.
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
- 6720 Parameter Filter not working Now look at line #33 the key is same (action_dispatch.req...