I have these models
class Car < ApplicationRecord
has_many :car_locations ,:dependent=>:destroy
has_many :rides,:dependent=>:destroy
end
class CarLocation < ApplicationRecord
belongs_to :car
end
class Ride < ApplicationRecord
belongs_to :car
end
There is a status attribute in Ride
Model of boolean
type.
Now I want those Car Locations whose car rides status is false
or don't have any car ride with in minimum complexity.
Aucun commentaire:
Enregistrer un commentaire