so I have these relationships:
a location:
has_many :services
has_many :products, :through => :services
a product:
has_many :services
has_many :locations, :through => :services
has_many :add_ons
and a service:
belongs_to :product
belongs_to :location
has_many :service_add_ons
has_many :add_ons, :through => :service_add_ons
a service_add_on:
belongs_to :service
belongs_to :add_on
How can I write a :through that will return a location with it's products and each products add_ons? so far I have:
wants.json { render :json => @location.to_json(:include => {:products => {:add_ons}}) }
which is obviously not working. What can I do to change this and make it work?