lib/kaminari/models/mongoid_criteria_methods.rb in kaminari-0.12.4 vs lib/kaminari/models/mongoid_criteria_methods.rb in kaminari-0.13.0

- old
+ new

@@ -1,18 +1,23 @@ module Kaminari module MongoidCriteriaMethods - extend ActiveSupport::Concern - module InstanceMethods - def limit_value #:nodoc: - options[:limit] - end + def limit_value #:nodoc: + options[:limit] + end - def offset_value #:nodoc: - options[:skip] - end + def offset_value #:nodoc: + options[:skip] + end - def total_count #:nodoc: - count + def total_count #:nodoc: + embedded? ? unpage.count : count + end + + private + def unpage + clone.tap do |crit| + crit.options.delete :limit + crit.options.delete :skip end end end end