aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_many_through_association.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-06-15 19:16:30 -0600
committerSean Griffin <sean@thoughtbot.com>2014-06-16 09:40:16 -0600
commite6690d37204dbd7154d275df75d9d0f98f5d2526 (patch)
treee4485022f5f2e8e1c42581cf968184a9b50b07aa /activerecord/lib/active_record/associations/has_many_through_association.rb
parentf59ed560ac68aad47e56b6b0442b0b855ae9951e (diff)
downloadrails-e6690d37204dbd7154d275df75d9d0f98f5d2526.tar.gz
rails-e6690d37204dbd7154d275df75d9d0f98f5d2526.tar.bz2
rails-e6690d37204dbd7154d275df75d9d0f98f5d2526.zip
Always update counter caches in memory when adding records
Before, calling `size` would only work if it skipped the cache, and would return a different result from the cache, but only if: - The association was previously loaded - Or you called size previously - But only if the size was 0 when you called it This ensures that the counter is appropriately updated in memory.
Diffstat (limited to 'activerecord/lib/active_record/associations/has_many_through_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/has_many_through_association.rb1
1 files changed, 0 insertions, 1 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 175019a72b..00234dc8f4 100644
--- a/activerecord/lib/active_record/associations/has_many_through_association.rb
+++ b/activerecord/lib/active_record/associations/has_many_through_association.rb
@@ -63,7 +63,6 @@ module ActiveRecord
end
save_through_record(record)
- update_counter(1)
record
end