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 [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
-~----------~----~----~----~------~----~------~--~---