This project is archived and is in readonly mode.

#41 ✓invalid
RSL

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

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