Shopify/shopify_api — pull request #86 by maartenvg (2014-01-09 15:59:34+00:00)
Title: Fix missing parent id/resource id on nested resources

### Problem
A bug described in #44 is as follows. You can't access the parent id of a nested resource due to ActiveResource eating up the prefix parameter. For example, when retrieving a Product Variant (either directly or via product X), `variant.product_id` does not exist.

There are two ways to retrieve an variant (or any other nested resource, like articles or events).
`v = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})`
and
`v = ShopifyAPI::Variant.find(808950810)`
will have no `v.product_id` accessor because ActiveResource filters it out.

### Solution
In the first call which includes the `:product_id` as a parameter, it's value is put into the `@prefix_options` hash. That means we can dynamically write an accessor for this property that returns its value from that hash.

The second call, directly to variant controller, does not have any parameters. Unfortunately ActiveResource still filters it out of the resulting JSON but does **not** put it in `@prefix_options`. It completely makes the parent id disappear. This is due to how we introduced conditional prefixing (if property present go to `/admin/products/...../variants/.....`, else go to `/admin/variants/.....`).

In those cases I've changed the filtering to stop removing it from `@prefix_options`

Review @csaunders @costford @pickle27

/cc @ideaoforder who issued the bug