aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-02-23 05:09:04 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-02-23 05:09:04 +0000
commite9d4b367ccb9d09c104e4045d9b0da8c2d8a88f4 (patch)
treeef9142af9569891a62046373023ebdd90c34d790 /activerecord/lib/active_record
parent54523831741ae443152055107fbb80c8b698a9d8 (diff)
downloadrails-e9d4b367ccb9d09c104e4045d9b0da8c2d8a88f4.tar.gz
rails-e9d4b367ccb9d09c104e4045d9b0da8c2d8a88f4.tar.bz2
rails-e9d4b367ccb9d09c104e4045d9b0da8c2d8a88f4.zip
Renamed Errors#count to Errors#size but kept an alias for the old name (and included an alias for length too) (closes #3920, #3320) [contact@lukeredpath.co.uk]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3639 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-xactiverecord/lib/active_record/validations.rb5
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