README.md in batch-loader-1.2.1 vs README.md in batch-loader-1.2.2
- old
+ new
@@ -1,10 +1,10 @@
# BatchLoader
[![Build Status](https://travis-ci.org/exAspArk/batch-loader.svg?branch=master)](https://travis-ci.org/exAspArk/batch-loader)
[![Coverage Status](https://coveralls.io/repos/github/exAspArk/batch-loader/badge.svg)](https://coveralls.io/github/exAspArk/batch-loader)
-[![Code Climate](https://img.shields.io/codeclimate/github/exAspArk/batch-loader.svg)](https://codeclimate.com/github/exAspArk/batch-loader)
+[![Code Climate](https://img.shields.io/codeclimate/maintainability/exAspArk/batch-loader.svg)](https://codeclimate.com/github/exAspArk/batch-loader/maintainability)
[![Downloads](https://img.shields.io/gem/dt/batch-loader.svg)](https://rubygems.org/gems/batch-loader)
[![Latest Version](https://img.shields.io/gem/v/batch-loader.svg)](https://rubygems.org/gems/batch-loader)
This gem provides a generic lazy batching mechanism to avoid N+1 DB queries, HTTP queries, etc.
@@ -293,12 +293,12 @@
```
For batches where the value is some kind of collection, such as an Array or Hash, `loader` also supports being called with a block, which yields the _current_ value, and returns the _next_ value. This is extremely useful for 1:Many relationships:
```ruby
-BatchLoader.for(user.id).batch(default_value: []) do |comment_ids, loader|
+BatchLoader.for(user.id).batch(default_value: []) do |user_ids, loader|
Comment.where(user_id: user_ids).each do |comment|
- loader.call(user.id) { |memo| memo << comment }
+ loader.call(comment.user_id) { |memo| memo << comment }
end
end
```
### Batch key