Skip to content

Commit

Permalink
fix ruby 2.2 warning: circular argument reference
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 committed Dec 23, 2014
1 parent ba886f7 commit 8fd5270
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ def count_records
[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)
Expand All @@ -77,7 +77,7 @@ def update_counter(difference, reflection = reflection)
# 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
Expand Down
2 changes: 1 addition & 1 deletion activesupport/lib/active_support/values/time_zone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def at(secs)
#
# Time.zone.now # => Fri, 31 Dec 1999 14:00:00 HST -10:00
# Time.zone.parse('22:30:00') # => Fri, 31 Dec 1999 22:30:00 HST -10:00
def parse(str, now=now)
def parse(str, now=now())
parts = Date._parse(str, false)
return if parts.empty?

Expand Down

0 comments on commit 8fd5270

Please sign in to comment.