
collection destroy! does not work with ParanoidDateTime
Reported by Alex Arnell | January 22nd, 2009 @ 01:42 PM
ParanoidDateTime
does not override any behavior
when working with association collections.
class Post
has n, :comments
end
class Comment
belongs_to :post
end
Post.first.comments.destroy! # creates an sql DELETE command
Post.first.comments.each { |c| c.destroy } # triggers use of deleted_at column
Comments and changes to this ticket
-
Dirkjan Bussink January 22nd, 2009 @ 03:56 PM
This is actually by design. The ! indicates that the method bypasses any callbacks, including paranoia. In the future there will be a Model#destroy that will adhere to callbacks.
-
Dan Kubb (dkubb) January 23rd, 2009 @ 03:43 AM
- State changed from unconfirmed to not-applicable
There will also be a Collection#destroy method that performs the equivalent of the each { |c| c.destroy } example above.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »