Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3 best way to create a comment system for posts

my first entry here.

I'm trying to add a comment system to our Posts model. However, I am not sure of the best way to go about it for a number of reasons. I'd like the comment system to be similar to that on Forrst.com but i'd rather have visitors who comment not need an account as the site is our company site not a large community.

Outline of features are:

  1. Visitor can comment on post, entering name, email and comment.
  2. Our team members can comment, i'd like these to be styled differently so would like the system to know it was from one of our team, they will be logged into the system when leaving a comment.
  3. Visitors and team members can reply to a comment. The system needs to know which comment it was in reply to.
  4. Lastly i'd like the system to know if the comment was written by the post author.

I have looked and been trying out acts_as_commentable_with_threading which seems perfect except everyone needs a user account to leave a comment, something I am trying to avoid unless anyone has other thoughts on that?

I have also implemented this myself by creating a comments model and using awesome_nested_set for the threading. Within the comments model I have a user_id which is only populated if the user is logged in (meaning they must be a team member), this seems a little messy though.

Does anyone have any thoughts on this?

Oh, and I would love each person to be notified of a reply to their comment (if pos).

Thanks in advance.

like image 268
Philip Benton Avatar asked Sep 02 '11 12:09

Philip Benton


2 Answers

There are lot of tools available to post comments and working with ruby on rails.

http://ruby-toolbox.com/categories/rails_comments.html

also you can customize according your own requirement instead of writing a messy code.

like image 86
HiteshRawal Avatar answered Oct 02 '22 23:10

HiteshRawal


If you do not want to integrate a third-party service like Disqus, you have Juvia The Comments and Commontator. Also you can count with opinio as alternative. but only with Rails 3 and at the moment and as notice the development seems stalled.

like image 29
Paulo Fidalgo Avatar answered Oct 03 '22 00:10

Paulo Fidalgo