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