module NeatPages::Implants::MongoidCriteriaImplant

*************************************************************************************

Insert the method paginate in a Mongoid model. This method will be use the limit
the number of results returned by a query.

*************************************************************************************

Public Instance Methods

paginate(current) click to toggle source
# File lib/neat_pages/implants/mongoid_implant.rb, line 6
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 NeatPages::Uninitalized, 'You need to initialize the pagination'
  end
end