I have a commenting system I use on different models (posts, reports,
events) meaning that I have some difficulties using depend => destroy
and counter cache.
I now use a sub_id in my comment indicating whether the comment
belongs to a post, event or report eg:
id | owner_id | category_id | text
0 1 post ...
1 1 event ...
2 2 report ...
3 2 post ...
Where the owner_id is the id own the post, event or report.
This approach makes it hard to use either counter cache or depend =>
destroy since it will only look at the owner_id. If a user deletes
post 1 it will also delete the comments of both event 1 and report 1.
Someone has a better approach to using 1 comment system for multiple
models or can I overwrite counter cache and depend destoy to make use
All help is greatly appreciated.