Skip to content

Commit fe16964

Browse files
committed
[MODEL] Added information about converting the results to Array with to_a
Closes elastic#94
1 parent 6516521 commit fe16964

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: elasticsearch-model/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@ response.any? { |r| r.title =~ /fox|dog/ }
194194
# => true
195195
```
196196

197+
To use `Array`'s methods (including any _ActiveSupport_ extensions), just call `to_a` on the object:
198+
199+
```ruby
200+
response.to_a.last.title
201+
# "Fast black dogs"
202+
```
203+
197204
#### Search results as database records
198205

199206
Instead of returning documents from Elasticsearch, the `records` method will return a collection

0 commit comments

Comments
 (0)