lib/kaminari/mongoid/mongoid_criteria_methods.rb in kaminari-mongoid-0.1.2 vs lib/kaminari/mongoid/mongoid_criteria_methods.rb in kaminari-mongoid-1.0.0.rc1
- old
+ new
@@ -1,15 +1,16 @@
+# frozen_string_literal: true
module Kaminari
module Mongoid
module MongoidCriteriaMethods
def initialize_copy(other) #:nodoc:
@total_count = nil
super
end
- def entry_name
- model_name.human.downcase
+ def entry_name(options = {})
+ model_name.human(options.reverse_merge(default: model_name.human.pluralize(options[:count])))
end
def limit_value #:nodoc:
options[:limit]
end
@@ -19,15 +20,13 @@
end
def total_count #:nodoc:
@total_count ||= if embedded?
unpage.size
+ elsif options[:max_scan] && options[:max_scan] < size
+ options[:max_scan]
else
- if options[:max_scan] && options[:max_scan] < size
- options[:max_scan]
- else
- size
- end
+ size
end
end
private
def unpage