:dependent => :destroy vs ON DELETE CASCADE

Sorry if I missed this in the docs somewhere.

My guess is that if I use :dependent => :destroy, then the application
sends commands to the db to destroy the dependent records.

If I am using a database that supports FKs and ON DELETE CASCADE, then
is there any point in using :dependent => :destroy ?

Hi Rick,

Rick S. wrote:

If I am using a database that supports FKs and
ON DELETE CASCADE, then is there any point
in using :dependent => :destroy ?

I think the point is in being able to keep that logic in the application
itself, rather than having to go to two seperate code bases to find out
what
the result of an Object.destroy will be.

Just my $.02

Best regards,
Bill

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs