Matt Jones
2009-Nov-04 02:26 UTC
Patch for review: make :delete_all on has_many with :primary_key not delete unrelated records
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3086 Just what the subject says - on 2-3-stable, destroying an object with a has_many association using :primary_key and :delete_all will try to match records against the destroyed record''s primary key rather than that declared in the association. Could cause data loss in some circumstances. Patch is tiny - one line + some support functions, and includes a test. Thanks! --Matt Jones
Chris Cruft
2009-Nov-07 19:24 UTC
Re: Patch for review: make :delete_all on has_many with :primary_key not delete unrelated records
Bump. Worth a look as this is a data corruption situation... On Nov 3, 9:26 pm, Matt Jones <al2o...@gmail.com> wrote:> https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3086 > > Just what the subject says - on 2-3-stable, destroying an object with > a has_many association using :primary_key and :delete_all will try to > match records against the destroyed record''s primary key rather than > that declared in the association. Could cause data loss in some > circumstances. > > Patch is tiny - one line + some support functions, and includes a test. > > Thanks! > > --Matt Jones