After a bit of experimentation i confirmed for myself that that is indeed the case :)
thanks a lot Andrew, this is great. I'd seen named scopes before but never really used them much and never realised their potential for managing includes. One thing i noticed which is interesting...lessons are joined to assets through a join table, 'elements'. if i use the with_assets scope for an association that goes through a join table, then rails does a further join to the assets table, like you'd expect with an include, so we have this situation: user JOIN user_usb_lessons JOIN lessons JOIN elements JOIN assets If, however, it's a simple association (such as user.lessons, which just uses Lesson's user_id field) then rails splits it off into three sql calls: the first to load the lessons, the second to load the elements (join table records) and the third to load the assets. I guess that three seperate simple calls were seen as preferable to a single JOIN? Anyway, thanks again! max -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---