I've just submitted my first patch, and I'd love to get some feedback
on it. This patching Rails thing is a bit daunting if you haven't done
it before! Not sure if I'm on the right track.

http://dev.rubyonrails.org/ticket/9129

>From the description:

A has_one or has_many relationship with :dependent set either :nullify
will incorrectly destroy the associated objects when the association
is reassigned or set to nil. Instead, the associated objects' foreign
keys should be nullified, as they are when the parent object is
destroyed.

For example, given this association:

  class Fred
    has_one :george, :dependent => :nullify
  end

The following will cause george to be destroyed.

  fred = Fred.create
  george = George.create(:fred_id => fred)

  fred.george = nil

The issue also extends to :dependent => :delete and :dependent
=> :delete_all. Associated objects are destroyed rather than deleted
when the association is reassigned.

The attached patch fixes this issue and makes :dependent behaviour
consistent in all circumstances the I can think of.

Cheers,

Pete Yandell
http://notahat.com/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to