destroy vs delete

Short answer: Yes

Slightly longer answer: destroy will not automatically destroy associated records. Rather than have Rails default to destroying your data, it sensibly refrains from rampages of destruction and leaves the owner of the data to decide its fate.

Um… Care to further explain that one? I’m a little fuzzy on the long answer, which seems to me to contradict the short answer.

RSL

Basically, when you call 'destroy' on an object, it will not automatically remove the associated records unless you specifically ask it to in the 'has_many' declaration.

askegg's long answer is quite poetic but a little complicated :0)

Steve Bartholomew wrote:

Basically, when you call 'destroy' on an object, it will not automatically remove the associated records unless you specifically ask it to in the 'has_many' declaration.

askegg's long answer is quite poetic but a little complicated :0)

What he said :slight_smile:

You don't want a framework to assume you want all related data to be destroyed.

Gotcha!