Refactor && simplify count_records.

This commit is contained in:
Emilio Tagua
2010-11-20 13:37:54 -03:00
committed by Aaron Patterson
parent e2bad8a2e7
commit 9f35799221

View File

@@ -42,11 +42,7 @@ module ActiveRecord
# documented side-effect of the method that may avoid an extra SELECT.
@target ||= [] and loaded if count == 0
if @reflection.options[:limit]
count = [ @reflection.options[:limit], count ].min
end
count
@reflection.options[:limit] ? [@reflection.options[:limit], count].min : count
end
def has_cached_counter?