diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index c8c4cf8845..44482235a3 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Added Errors#any? to mean !Errors#empty? [DHH] + * Support the :column option for remove_index with the PostgreSQL adapter. #3661 [shugo@ruby-lang.org] * Add documentation for add_index and remove_index. #3600 [Manfred Stienstra ] diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index 27ca8d37d1..30f41530b0 100755 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -147,6 +147,11 @@ module ActiveRecord def empty? return @errors.empty? end + + # Returns true if errors have been added. + def any? + !empty? + end # Removes all the errors that have been added. def clear