Description
Allows for threaded comments to be added to multiple and different models. Drop-in compatible for acts_as_commentable (however requiring a database schema change)
Acts As Commentable with Threading alternatives and similar gems
Based on the "Social" category.
Alternatively, view acts_as_commentable_with_threading alternatives based on common mentions on social networks and blogs.
-
ActsAsTaggableOn
A tagging plugin for ActiveRecord that allows for custom tagging along dynamic contexts. -
PublicActivity
Provides easy activity tracking for your ActiveRecord, Mongoid 3 and MongoMapper models in Rails 3 and 4. Similar to Github's Public Activity. -
ActiveRecord Reputation System
An Active Record Reputation System for Rails. -
Acts As Votable
Allow any ActiveRecord model to be voted on, like/dislike, upvote/downvote, etc. -
Merit
Adds reputation behavior to Rails apps in the form of Badges, Points, and Rankings for ActiveRecord or Mongoid. -
acts_as_follower
Allow any ActiveRecord model to follow any other model. -
Acts As Commentable
Provides a single Comment model that can be attached to any model(s) within your app. -
Postwill
Posting to the most popular social media from Ruby -
Metka
Rails gem to manage tags with PostgreSQL array columns.
Get performance insights in less than 4 minutes.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of Acts As Commentable with Threading or a related project?
README
Acts As Commentable (now with comment threads(TM)!!! -- kidding on the (TM))
Allows for threaded comments to be added to multiple and different models. Drop-in compatible for acts_as_commentable (however requiring a database schema change)
Requirements
The 2.x version of this gem is for Rails 4 and later versions only. For the Rails 3.x compatible version of this gem, please use version 1.2.0.
This gem depends on CollectiveIdea's Awesome Nested Set gem. It is installed if not already present when you install this gem.
You can find the gem on GitHub at collectiveidea/awesome_nested_set
Install
In your Gemfile, add:
gem 'acts_as_commentable_with_threading'
and run bundle install
.
Migrations
To install from scratch:
rails generate acts_as_commentable_with_threading_migration
This will generate the migration script necessary for the table
To upgrade to acts_as_commentable_with_threading from the old acts_as_commentable:
rails generate acts_as_commentable_upgrade_migration
This will generate the necessary migration to upgrade your comments table to work with acts_as_commentable_with_threading
If the generators fail, you can just as easily create the migrations by hand.
See the templates in the generators under lib/generators
.
Usage
class Article < ActiveRecord::Base
acts_as_commentable
end
Add a comment to a model instance, for example an Article:
@article = Article.find(params[:id]) @user_who_commented = @current_user @comment = Comment.build_from( @article, @user_who_commented.id, "Hey guys this is my comment!" )
To make a newly created comment into a child/reply of another comment:
@comment.move_to_child_of(the_desired_parent_comment)
To retrieve all comments for an article, including child comments:
@all_comments = @article.comment_threads
To retrieve only the root comments without their child comments:
@root_comments = @article.root_comments
To check if a comment has children:
@comment.has_children?
To verify the number of children a comment has:
@comment.children.size
To retrieve a comment's children:
@comment.children
If you plan to use the
acts_as_votable
plugin with your comment system be sure to uncomment the lineacts_as_votable
inlib/comment.rb
.
Credits
- xxx - For contributing the updates for Rails 3!
- Jack Dempsey - This plugin/gem is heavily influenced/liberally borrowed/stolen from acts_as_commentable.
And in turn...
- Xelipe - Because acts_as_commentable was heavily influenced by Acts As Taggable.