Sha256: b2ac8e0160d4dc82f801f265db9480d6b8a59c3b7c706e79913a2882b870dabe

Contents?: true

Size: 463 Bytes

Versions: 10

Compression:

Stored size: 463 Bytes

Contents

module NeatPages::Implants
  module MongoidCriteriaImplant
    def paginate(current)
      if current
        current.set_total_items self.count

        raise NeatPages::OutOfBound if current.out_of_bound?

        return self.offset(current.offset).limit(current.limit)
      else
        raise 'You need to initialize the pagination'
      end
    end
  end
end

Mongoid::Criteria.send :include, NeatPages::Implants::MongoidCriteriaImplant if defined? Mongoid

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
neat-pages-0.1.7 lib/neat_pages/implants/mongoid_implant.rb
neat-pages-0.1.6 lib/neat_pages/implants/mongoid_implant.rb
neat-pages-0.1.5 lib/neat_pages/implants/mongoid_implant.rb
neat-pages-0.1.4 lib/neat_pages/implants/mongoid_implant.rb
neat-pages-0.1.3 lib/neat_pages/implants/mongoid_implant.rb
neat-pages-0.1.2 lib/neat_pages/implants/mongoid_implant.rb
neat-pages-0.1.1 lib/neat_pages/implants/mongoid_implant.rb
neat-pages-0.1.0 lib/neat_pages/implants/mongoid_implant.rb
neat-pages-0.0.2 lib/neat_pages/implants/mongoid_implant.rb
neat-pages-0.0.1 lib/neat_pages/implants/mongoid_implant.rb