Module: MongoMapper::Plugins::Pagination::ClassMethods
- Defined in:
- lib/mongo_mapper/plugins/pagination.rb
Instance Method Summary collapse
Instance Method Details
#paginate(options) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/mongo_mapper/plugins/pagination.rb', line 10 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
6 7 8 |
# File 'lib/mongo_mapper/plugins/pagination.rb', line 6 def per_page 25 end |