Some time ago, I asked (joins across several tables using ActiveRecord with named scopes) Comes into several tables using ActiveRecord with named scopes
Now I need to create a named scope that includes a join of more than two tables, for example:
named_scope :baz_category, lambda {|c| {:joins=>([:foo,:bar,:baz]):conditions=>['baz_cat=',c]}}
Where Foo has one bar and one bar, there is one Baz.
I would like the solution to work on 4th or 5th, etc. tables.
Thank you very much for helping me with this.
source
share