Displaying 1 result from an estimated 1 matches for "lesson_id".
Did you mean:
lesson_6
2009 Mar 25
0
Optimise this association?
...(I
don''t care about position in this case)
I can think of ways to do it, eg
has_many :resources, :finder_sql => ''select * from resources where
resources.id in (select items.resource_id from items where
items.asset_id in (select elements.asset_id from elements where
elements.lesson_id = #{id}))''
But this feels dirty and in fact doesn''t even work - it''s complaining
about the brackets which seem to be getting broken when it inserts a
''count(*) from elements'' segment in there.
What''s the ''nicest'' way to do it...