Sha256: 841e911d669e168ef6d631570f4a99d1ec67368af500560603e470cff1575ce4

Contents?: true

Size: 955 Bytes

Versions: 1

Compression:

Stored size: 955 Bytes

Contents

# Mongoid::Paginate [![Build Status](https://secure.travis-ci.org/seanslerner/mongoid_paginate.png)](https://secure.travis-ci.org/seanslerner/mongoid_paginate.png)

Mongoid::Paginate provides simple pagination for Mongoid ODM.

## Installation

Add this line to your application's Gemfile:

    gem 'mongoid_paginate'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install mongoid_paginate

## Usage

```ruby
class Document
  include Mongoid::Document
  include Mongoid::Paginate

  field :name, type: String

  paginate(per_page: 20)
end

# works just like a scope
Document.paginate(params[:page])

# for working in the view, calculate the total number of pages
@pages = Document.pages
```

## 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

1 entries across 1 versions & 1 rubygems

Version Path
mongoid_paginate-0.0.1 README.md