whichdigital/active-rest-client — pull request #53 by asurin (2014-06-26 20:58:55+00:00)
Title: Allows you to map a lazy-loaded result to a specific class

I'm currently working with the NewRelic API via. ActiveRestClient. The API has some complex nesting, that basically equates to the following

Applications -> Links -> Servers

I'm using a proxy to remove each level's root keys, and to cut out the 'links' segment. At that point, the association declarations on my application object looks very much like:

get :find, '/applications/:id.json', lazy: { servers: Server }

In the current release this doesn't appear to be respecting the class binding - the system was still applying the proxy for the Application object to the lazy-loaded result.

The patch here causes the correct proxy to be applied and ensures the returned object is of the class type bound. If this is already supported and I'm just doing it wrong feel free to close (Although a hint as to the right way would be awesome!)