Meltemi
Meltemi

Reputation: 38359

Add commenting to a Rails "blog". Advice: polymorphic or gem like Ancestry?

Simple blog with Post and probably Comment models. Would like users to be able to comment on posts or comment on the comments themselves. I haven't done this before so looking for guidance.

Initially thought to roll my own with a polymorphic relationship of both Post & Comment to "Commentable". But wondering how taxing that might be on a Post index page that will draw in the last 5-10 posts and show their most recent 5 or so comments?

Watched Railscast #262 about Trees with Ancestry...this looks promising but may be overkill and seems to be recursive to a single model, as opposed to a Post (editable by users) and a Comment (editable by anyone).

Any advice or suggestions?

Upvotes: 1

Views: 556

Answers (1)

Geoff Lanotte
Geoff Lanotte

Reputation: 7510

I started doing the same thing, but when I started having to deal with spam and verifying people and the joys that comes with managing comments, I ended up just going with disqus and will never look back. Disqus just handles it all and it let me focus on other things. There is a rails gem for it, although I just wrote my own helpers.

If you must roll your own, check out acts_as_commentable.

Upvotes: 1

Related Questions