class Author belongs_to :book end class Book < ActiveRecord::Base has_one :sales_data has_many :authors end class SalesData < ActiveRecord::Base belongs_to :book end What code would be required to directly find the Authors from the SalesData? i.e. in SQL: SELECT SUM(sales_data.price), authors.name FROM sales_data LEFT JOIN authors ON sales_data.book_id = authors.book_id GROUP BY authors.name I know I could use find_by_sql ... just looking for something a little cleaner - has_many(:through) doesn''t seem to work. Is this a bug in has_many :through or am I just using it wrong? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---