README.md in elasticsearch-model-0.1.1 vs README.md in elasticsearch-model-0.1.2
- old
+ new
@@ -192,10 +192,17 @@
```ruby
response.any? { |r| r.title =~ /fox|dog/ }
# => true
```
+To use `Array`'s methods (including any _ActiveSupport_ extensions), just call `to_a` on the object:
+
+```ruby
+response.to_a.last.title
+# "Fast black dogs"
+```
+
#### Search results as database records
Instead of returning documents from Elasticsearch, the `records` method will return a collection
of model instances, fetched from the primary database, ordered by score:
@@ -243,13 +250,14 @@
```
#### Pagination
You can implement pagination with the `from` and `size` search parameters. However, search results
-can be automatically paginated with the [`kaminari`](http://rubygems.org/gems/kaminari) gem.
+can be automatically paginated with the [`kaminari`](http://rubygems.org/gems/kaminari) or
+[`will_paginate`](https://github.com/mislav/will_paginate) gems.
-If Kaminari is loaded, use the familiar paging methods:
+If Kaminari or WillPaginate is loaded, use the familiar paging methods:
```ruby
response.page(2).results
response.page(2).records
```
@@ -262,10 +270,10 @@
@articles.current_page
# => 2
@articles.next_page
# => 3
```
-To initialize and include the pagination support manually:
+To initialize and include the Kaminari pagination support manually:
```ruby
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
```