diff options
Diffstat (limited to 'activerecord/lib/active_record/validations.rb')
-rwxr-xr-x | activerecord/lib/active_record/validations.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index 7d1661449c..f733620298 100755 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -155,11 +155,14 @@ module ActiveRecord # Returns the total number of errors added. Two errors added to the same attribute will be counted as such # with this as well. - def count + def size error_count = 0 @errors.each_value { |attribute| error_count += attribute.length } error_count end + + alias_method :count, :size + alias_method :length, :size end |