1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00

Eliminate unneeded local variable in MongoidCriteriaMethods

* #count already caches the result
 * change indent
 * we prefer && to `and`
This commit is contained in:
Yuki Nishijima 2014-03-19 19:16:54 -07:00
parent 1f577d9af0
commit 584c3ba1aa

View file

@ -13,17 +13,15 @@ module Kaminari
end
def total_count #:nodoc:
@total_count ||=
if embedded?
unpage.count
@total_count ||= if embedded?
unpage.count
else
if options[:max_scan] && options[:max_scan] < count
options[:max_scan]
else
counter_result = count
if options[:max_scan] and options[:max_scan] < counter_result
options[:max_scan]
else
counter_result
end
count
end
end
end
private