Querying on join-tables in Rails

If I was doing this I might do something like...

@cars = Car.find(:all,
    :conditions => ["Cars.id in (select Car_id from Passengers where last_name = ?)","Villalobos"],
    :joins=> "left join (Passengers) on (Cars.id = Passengers.car_id)")

It doesn't seem very Rail-errific, but I'll bet somebody else's money it would work.

HTH,

Andy

P-daddy schrieb: