Module: MongoMapper::Plugins::Pagination::ClassMethods
- Defined in:
- lib/mongo_mapper/plugins/pagination.rb
Instance Method Summary collapse
Instance Method Details
#paginate(options) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/mongo_mapper/plugins/pagination.rb', line 9 def paginate() per_page = .delete(:per_page) || self.per_page page = .delete(:page) total_entries = count() pagination = Pagination::Proxy.new(total_entries, page, per_page) .update(:limit => pagination.limit, :skip => pagination.skip) pagination.subject = find_many() pagination end |
#per_page ⇒ Object
5 6 7 |
# File 'lib/mongo_mapper/plugins/pagination.rb', line 5 def per_page 25 end |