jackdempsey / acts_as_commentable

The ActiveRecord acts_as_commentable plugin
http://juixe.com/svn/acts_as_commentable/
MIT License
834 stars 178 forks source link

When User.destroy, associated comments not deleted #36

Closed mrcook closed 10 years ago

mrcook commented 10 years ago

When destroying a user I was expecting all associated comments to be deleted too, but they are not. Naturally, this causes issues for all those Post with comments by that user.

Is this behaviour correct?

For the moment I've created an after_destroy callback on the User but it feels like this should be part of acc.

jackdempsey commented 10 years ago

Hi Mike,

In my opinion it is. You can make the same claim for deleting comments automatically and then having anything associated to or linking to them be in error as well. In the past I've done a quick check on the comment creator and put in '[Deleted'] or something similar if the user is gone.

If you're interested in patching things so you can pass in options to the acts_as_commentable call and having them propagate down into the base has_many, I'd probably merge it in. I just dont' have time to do that type of dev myself these days.

cheers

On Fri, Aug 16, 2013 at 7:36 AM, Mike Cook notifications@github.com wrote:

When destroying a user I was expecting all associated comments to be deleted too, but they are not. Naturally, this causes issues for all those Post with comments by that user.

Is this behaviour correct?

For the moment I've created an after_destroy callback on the User but it feels like this should be part of acc.

— Reply to this email directly or view it on GitHubhttps://github.com/jackdempsey/acts_as_commentable/issues/36 .

mrcook commented 10 years ago

I'm still very much a beginner and on top of that my app is only a couple of weeks old. Once I'm more settled with my site I may take a look to see if I'm up to such a task.

Thanks for the feedback, good to know that my thinking was on the right track!

Mike

jackdempsey commented 10 years ago

Happy to help!