sql - Rails When using dependent destroy and dependent nullify -
i want know relation dependent destroy , dependent nullify on rails , relation sql.
thanks
example: table users , table cars
user has many cars car belongs users
in table car have user_id on each row
if set dependent destroy when defining relationship in users, when delete user, cars having user_id deleted also
if set nullify, cars remain, user_id column set null (it pointless have value there because user id deleted)
hope helps
Comments
Post a Comment