ActiveRecord inner joins

Tim Booher wrote:

I have these models:

User -> Order -> Registration <- Camp

So a user has many orders, orders have many registrations and camps have
many registrations.

I have all the associations written up correctly, but I want to know how
to get all the users for a particular camp.


@camp = Camp.find_by_name("band camp")
mycampers = @camp.orders.registrations.users

naturally, this doesn't work -- do i have to use sql here? the :include
option to find looks good, but I can't get it to work.

Something like

   User.find :all, :select => 'distinct users.*',
             :joins => {:orders => {:registrations => :camp}},
             :conditions => [' = ?', camp_name]