tricky include question

I've been here before and maybe I'm trying to do something that is not possible. I am trying to include tables that are associated to other tables in the actual include statement but not to the original table call. In this case the furnii table.

this is my original query

@furnii_from_furnii = Furni.find :all, :include =>[:raider, {:imageasset => :skin}], :conditions => ""+Furni.conditions_by_like(@search)+" OR " +Raider.conditions_by_like(@search) + "OR" +Skin.conditions_by_like(@search) + ""

now I need to include 2 more tables skintype and skinstyle. these 2 tables are not associated to either furnii or imageassets but have an association to the skin table, which is associated to furnii through imageassets.

Sure you can, you can nest includes as deep as you want. I've got some examples at http://www.spacevatican.org/2008/8/8/nested-includes-and-joins

Fred

Frederick Cheung wrote:

+Skin.conditions_by_like(@search) + ""

now I need to include 2 more tables skintype and skinstyle. these 2 tables are not associated to either furnii or imageassets but have an association to the skin table, which is associated to furnii through imageassets.

Sure you can, you can nest includes as deep as you want. I've got some examples at http://www.spacevatican.org/2008/8/8/nested-includes-and-joins

Fred

Thanks for the link. I'm still not sure on how to join the 2 tables in question.

I tried :include =>[:raider, {:imageasset => {:skintype =>:skin}] but that is not finding the association I tried :include =>[:raider, {:imageasset => {:skin =>:skintype}] that is not working ether.

skin belongs to skintype so I'm not sure how to load it

Sam Ginko wrote:

I tried :include =>[:raider, {:imageasset => {:skintype =>:skin}] but that is not finding the association I tried :include =>[:raider, {:imageasset => {:skin =>:skintype}] that is not working ether.

skin belongs to skintype so I'm not sure how to load it

Please disregard the question above. Your examples cleared it all up. Thanks again for your help.