nesquena/rabl — Issue #160: Accessing child of a child using Rabl
Author: aknicol
Created: 2012-02-06 06:16:16+00:00
State: open

I have three tables -- stores, addresses and sales. Each store has one or more addresses. Each store also has one or more sales. These relationships are defined in my models. I have a Rabl API that is returning information about sales. I can easily access the store information by using child as follows:

object @sales

attributes :name, :description

child :store do
attributes :id, :name
end

However, how do I access the addresses information pertaining to that store? There is no direct relationship between sales and addresses specified in the model; the relationship is between stores and addresses.