rails scope and joins

Viewed 27607

I have tried everything i thought would work for this and am turning up nothing.

in rails 3, I need to find all users with a cd player in their car. A car has one user and one radio, and a user belongs to a car, and a radio has many cars.

I am stumbling on how I would perform this search via a scope in the user model.

class User  
  belongs_to :car

class Car  
  belongs_to radio
  has_one :user, :dependent => destroy

class Radio  
  has_many :cars
1 Answers
Related