If I have a model Person, which has_many Vehicles and each Vehicle can be of type car or motorcycle, how can I query for all persons, who have cars and all persons, who have motorcycles?
I don't think these are correct:
Person.joins(:vehicles).where(vehicle_type: 'auto')
Person.joins(:vehicles).where(vehicle_type: 'motorcycle')