Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #7096 (new defect)

Opened 2 years ago

Last modified 1 year ago

[PATCH] has_one dependent delete on reassign

Reported by: aeden Assigned to: bitsweat
Priority: normal Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: normal Keywords: dependent destroy
Cc: esad@esse.at

Description

Patch which fixes the ticket #2265. Added the dont_save option to the new_record method, default it to true, and pass the value to the replace method. The create and create! methods now pass false as the dont_save option.

Side note: the dont_save negation in the line 28 is confusing. Perhaps it should be save.

Attachments

has_one_dependent_destroy_on_reassign.diff (3.0 kB) - added by aeden on 01/16/07 19:32:52.
Patch and Unit Test

Change History

01/16/07 19:32:52 changed by aeden

  • attachment has_one_dependent_destroy_on_reassign.diff added.

Patch and Unit Test

05/23/07 00:29:10 changed by esad

  • cc set to esad@esse.at.

Great, any chances of getting this into trunk? I'm bit tired of manually destroying objects on reassignment

05/25/07 20:59:44 changed by bitsweat

  • keywords set to dependent destroy.
  • owner changed from core to bitsweat.

Seems like a fine idea, but why's it limited to has_one?

05/30/07 20:54:45 changed by aeden

I think that I only implemented it on has_one because that's where the original issue occurred at. What I can't remember is whether or not I looked through has_many to see if it was affected as well. Would you like me to look into it?