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:
parent
1f577d9af0
commit
584c3ba1aa
1 changed files with 7 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue