batmanjs/batman — pull request #906 by cjoudrey (2013-11-21 22:34:59+00:00)
Title: Fix crash when model with null-valued association is decoded

Suppose you have a `Product` that belongs to a `Shop`.

Decoding a `Product` that does not have a `Shop` works fine, i.e.:

```coffee
products: [
{
id: 1
title: 'Shirt'
}
]
```

However, decoding a `Product` that has a `null` value for `shop` causes an exception `TypeError: Cannot read property 'id' of null` here: https://github.com/Shopify/batman/blob/fix-null-valued-associations-crash/src/model/model.coffee#L163

```coffee
products: [
{
id: 1
title: 'Shirt'
shop: null
}
]
```

Do you think the current solution is good or should I `return if attributes is null` in `_loadRecord` instead?

### Review

@kristianpd @angelini @pushrax @nickjs