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

Bump. Worth a look as this is a data corruption situation...