Permalink
Browse files

Renamed Errors#count to Errors#size but kept an alias for the old nam…

…e (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
  • Loading branch information...
1 parent 5452383 commit e9d4b367ccb9d09c104e4045d9b0da8c2d8a88f4 @dhh dhh committed Feb 23, 2006
Showing with 6 additions and 1 deletion.
  1. +2 −0 activerecord/CHANGELOG
  2. +4 −1 activerecord/lib/active_record/validations.rb
View
2 activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Renamed Errors#count to Errors#size but kept an alias for the old name (and included an alias for length too) #3920 [contact@lukeredpath.co.uk]
+
* Reflections don't attempt to resolve module nesting of association classes. Simplify type computation. [Jeremy Kemper]
* Improved the Oracle OCI Adapter with better performance for column reflection (from #3210), fixes to migrations (from #3476 and #3742), tweaks to unit tests (from #3610), and improved documentation (from #2446) #3879 [Aggregated by schoenm@earthlink.net]
View
5 activerecord/lib/active_record/validations.rb
@@ -155,11 +155,14 @@ def clear
# 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

0 comments on commit e9d4b36

Please sign in to comment.