Sha256: 75b35034eeee95b1798da9ba3765b3c2eb679cacd584bcc11b18493f36c384cb
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
# SimplePaginator This is a useful pagination library especially building APIs. ## Feature - Does not issue `count`. - You can set max page. - You can set number of records per page. ## Installation Add this line to your application's Gemfile: gem 'simple_paginator' And then execute: $ bundle ## Usage Include SimplePaginator into your models like below. ``` class Post < ActiveRecord::Base include SimplePaginator end ``` You can get paginated records using `Post.paged(page)` method. Default is 25 records / page, maximum page number is 10. You will get 26 (per_page + 1) records when you can get next page. ``` Post.paged(1) #=> returns 26 records at most. Post.paged(11) #=> returns 0 records if page is more than max_page. ``` You can use `per_page`, `max_page` to change default behavior. ``` class Post < ActiveRecord::Base include SimplePaginator per_page 10 max_page 5 end ``` ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
simple_paginator-0.0.3 | README.md |
simple_paginator-0.0.2 | README.md |