diff options
author | Aman Gupta <aman@tmm1.net> | 2014-12-22 20:14:14 -0800 |
---|---|---|
committer | Aman Gupta <aman@tmm1.net> | 2014-12-22 20:14:14 -0800 |
commit | 8fd52705eda6a2cd7e9a8a5bc723fa094e359eb7 (patch) | |
tree | 74ecb50d25d2624800ce55cbf321f6bef878dee0 /activerecord/lib/active_record/associations/has_many_association.rb | |
parent | ba886f73a2b4a06f3400f0698290c54566639b6a (diff) | |
download | rails-8fd52705eda6a2cd7e9a8a5bc723fa094e359eb7.tar.gz rails-8fd52705eda6a2cd7e9a8a5bc723fa094e359eb7.tar.bz2 rails-8fd52705eda6a2cd7e9a8a5bc723fa094e359eb7.zip |
fix ruby 2.2 warning: circular argument reference
Diffstat (limited to 'activerecord/lib/active_record/associations/has_many_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 290f81479d..c9bca68904 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -50,15 +50,15 @@ module ActiveRecord [options[:limit], count].compact.min end - def has_cached_counter?(reflection = reflection) + def has_cached_counter?(reflection = reflection()) owner.attribute_present?(cached_counter_attribute_name(reflection)) end - def cached_counter_attribute_name(reflection = reflection) + def cached_counter_attribute_name(reflection = reflection()) "#{reflection.name}_count" end - def update_counter(difference, reflection = reflection) + def update_counter(difference, reflection = reflection()) if has_cached_counter?(reflection) counter = cached_counter_attribute_name(reflection) owner.class.update_counters(owner.id, counter => difference) @@ -77,7 +77,7 @@ module ActiveRecord # it will be decremented twice. # # Hence this method. - def inverse_updates_counter_cache?(reflection = reflection) + 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| inverse_reflection.counter_cache_column == counter_name |