aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_many_association.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-05-26 18:08:26 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-05-26 18:08:26 -0300
commit923e274313dda8c772922e859df681f3d050a30e (patch)
treeef31fe6a9a6e3ab9570e9eb0753f90f7e9faa29e /activerecord/lib/active_record/associations/has_many_association.rb
parente11e285b1373b0399433943198aefbcdd29db09b (diff)
parent00b024218f1c91fde1217ae4951bd2c817bc9ea9 (diff)
downloadrails-923e274313dda8c772922e859df681f3d050a30e.tar.gz
rails-923e274313dda8c772922e859df681f3d050a30e.tar.bz2
rails-923e274313dda8c772922e859df681f3d050a30e.zip
Merge pull request #15300 from arthurnn/refactor_reflections
Refactor reflections
Diffstat (limited to 'activerecord/lib/active_record/associations/has_many_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/has_many_association.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb
index f5e911c739..2727e23870 100644
--- a/activerecord/lib/active_record/associations/has_many_association.rb
+++ b/activerecord/lib/active_record/associations/has_many_association.rb
@@ -100,7 +100,8 @@ module ActiveRecord
# Hence this method.
def inverse_updates_counter_cache?(reflection = reflection())
counter_name = cached_counter_attribute_name(reflection)
- reflection.klass.reflect_on_all_associations(:belongs_to).any? { |inverse_reflection|
+ reflection.klass._reflections.values.any? { |inverse_reflection|
+ :belongs_to == inverse_reflection.macro &&
inverse_reflection.counter_cache_column == counter_name
}
end