Rails Scales!: Missing code from example (p133)

On p133, under the section “Implementing Sharding”, there is a code sample missing an index which is discussed in a following paragraph.

The specific example is at the bottom of p133 and has to do with the shard method of the store model.

def shard
[:shard_one, :shard_two, :shard_three]
end

This is missing the index of [id % 3] at the end of the line. It should be:

def shard
[:shard_one, :shard_two, :shard_three][id % 3]
end

Affected version: P1.0

Present in:

Thanks!