aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2014-12-23 13:54:34 -0700
committerSean Griffin <sean@seantheprogrammer.com>2014-12-23 13:54:34 -0700
commita862c39b8804a9ee2f94945ae607b255c9f61c49 (patch)
tree25438888db0a5bb938629507222d22059c51eb1c /activerecord
parenta0e34619b8b3b3aafa68151fd99b218f069ee7a8 (diff)
parentd03da5948c775fb56a83d4b7e2cbf6dc8a9f4674 (diff)
downloadrails-a862c39b8804a9ee2f94945ae607b255c9f61c49.tar.gz
rails-a862c39b8804a9ee2f94945ae607b255c9f61c49.tar.bz2
rails-a862c39b8804a9ee2f94945ae607b255c9f61c49.zip
Merge pull request #18174 from bogdan/cleanup_has_many_though_association_count
Remove unneeded special case to calculate size for has_many :through
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/has_many_through_association.rb15
1 files changed, 0 insertions, 15 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb
index 3f4d3bfc08..7a050ca224 100644
--- a/activerecord/lib/active_record/associations/has_many_through_association.rb
+++ b/activerecord/lib/active_record/associations/has_many_through_association.rb
@@ -13,21 +13,6 @@ module ActiveRecord
@through_association = nil
end
- # Returns the size of the collection by executing a SELECT COUNT(*) query
- # if the collection hasn't been loaded, and by calling collection.size if
- # it has. If the collection will likely have a size greater than zero,
- # and if fetching the collection will be needed afterwards, one less
- # SELECT query will be generated by using #length instead.
- def size
- if has_cached_counter?
- owner._read_attribute cached_counter_attribute_name(reflection)
- elsif loaded?
- target.size
- else
- super
- end
- end
-
def concat(*records)
unless owner.new_record?
records.flatten.each do |record|