Luca Guidi
2009-Mar-06  01:42 UTC
[PATCH] Nested attributes doesn''t run removing association callbacks
class Person < ActiveRecord::Base
   has_many :emails, :after_remove => :set_preferred_email
   accepts_nested_attributes_for :emails, :allow_destroy => true
   private
     def set_preferred_email
       # ...
     end
end
person.emails.delete(email) # => it run the callback
person.update_attributes :emails_attributes => [{:id => email.id, 
:_delete => 1}] # => it doesn''t run the callback
I created a patch and a LH ticket: http://bit.ly/JjgfZ
Luca
-- 
blog: www.lucaguidi.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 rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---