A while ago I asked (Joins across multiple tables with ActiveRecord with named scopes) http://stackoverflow.com/questions/1189086/joins-across-multiple-tables-with-activerecord-with-named-scopes
Now I need to create a named scope that involved joining across more than two tables, eg:
named_scope :baz_category, lambda {|c| {:joins=>([:foo,:bar,:baz]):conditions=>['baz_cat=',c]}}
Where Foo has one Bar and Bar has one Baz.
I'd like a solution to work for a 4th or 5th etc table.
many many thanks to whoever helps me with this one.