drapergem/draper — pull request #332 by haines (2012-11-08 13:39:03+00:00)
Title: Extract decorated associations

Continuing on the refactoring warpath, the next target is `Decorator#decorates_association`.

I've extracted it into its own class, and simplified the logic. It was previously using `reflect_on_association` when available, which was unnecessary since we had already fetched the associated object and can thus infer the decorator directly.

I'm not 100% happy with

```ruby
def collection?
source.respond_to?(:first)
end
```

but that was how it worked before, so it doesn't break anything. I'm tempted to file this under "good enough for now", unless there are any ideas to improve it.