This project is archived and is in readonly mode.
Calling delete on a has_many :through association does not call destroy on the association object
-
Martin Andert
Forgot the Annotation model above:
class Annotation < ActiveRecord::Base belongs_to :group_content_assignment endTo make things clearer...
group.assigned_contents.delete content... deletes the association record in the db using SQL, but doesn't call destroy on its AR instance, so all annotations aren't destroyed (although declared with dependent => destroy).
-
Martin Andert
Commit 47bdf3bf40ec17e1f8ca1c0e3d7f697d0c4cd1bf added a
destroymethod toAssociationCollection. Now I can callgroup.assigned_contents.destroy contentinstead of calling
group.assigned_contents.delete contentThis should fix it.
-
Eloy Duran
- State changed from new to resolved
I'm closing this, since that's probably what you meant to say, even though you reported a problem with the current behaviour to #2146. As I commented on that ticket, please open a new ticket with for the specific problem for any further discussion.
Thanks