redding/mr — pull request #149 by jcredding (2014-01-02 03:48:43+00:00)
Title: Fix `FakeRecord::Associations` mixin for polymorphic

This fixes the implementation of associations by ensuring an
association knows it's fake record. This allows polymorphic
associations to read the foreign type and constantize it. In MR,
this is needed by record factories and stacks to properly build
associations as needed.

The previous implementation built reflections from associations,
when ActiveRecord actually does it the other way. Furthermore,
since an association needs to know it's fake record, it has to
be lazily-built when the `association` instance method is called.
Thus, reflections are built when an association method
(`belongs_to`) is called and associations are built from
reflections when `association` is called.