I have a question regarding the one to one relationship
I have a model
Car
has_one:company
and
Company:
belongs_to:car
so as a result I have car_id column in Company model. So when a create a new car for a particular company and pass the parameters the car_id value automatically gets updated to the new car_id created.
However when I destroy or delete a particular car the corresponding company’s car_id doesnot get updated to nil.It remains as it is which is undesirable because there is no such car_id exists.I want to change the car_id field of the corresponding company to nil when I delete particular car.
This should set the car_id to null in company table. But, I wonder if this association should be has_one_through instead of has_one.