rails/rails — pull request #14267 by arthurnn (2014-03-04 01:09:11+00:00)
Title: Association scope should work when a nil value is returned.

### Problem
We have some associations that need to associate 2 fks, when the record exists.
```ruby
has_one :transfer, -> (record) {
where(shop_id: record.shop_id) if record
}, foreign_key: 'transfer_id', primary_key: 'transfer_id'
```

So when the `record` is nil, we will return a nil object to the proc. We should be able to deal with that easily just short-circuiting it.

review @carlosantoniodasilva @tenderlove