Hi, I''d like to use the power of ActiveRecord''s associations to build the join section of a query and also be able to add a group section or change the select part. For example (this doesn''t work) Person.find :all, :include => [:portfolio => :houses], :group => ''people.id'', :select => ''people.*, count(*) as house_count, avg(houses.price) as house_avg_price'' Using the :include statement ignores the group and select statements. This is fair enough since you can''t do proper eager loading with either of those statements. What I would like is for the :joins option to be able to use the tree syntax of the :include option and create a select using the ActiveRecord associations. The above example would look like this: Person.find :all, :joins => [:portfolio => :houses], :group => ''people.id'', :select => ''people.*, count(*) as house_count, avg(houses.price) as house_avg_price'' Does this make sense? Cheers, Bonne Eggleston --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---