Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
The ActiveRecord acts_as_commentable plugin
Ruby
tree: 3a1537dcb9

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
rails
tasks
test
.gitignore
CHANGELOG
MIT-LICENSE
README.rdoc
Rakefile
acts_as_commentable.gemspec
init.rb
install.rb

README.rdoc

Acts As Commentable

Allows for comments to be added to multiple and different models.

Resources

Install

  • To install as a gem (recommended):

** gem install acts_as_commentable ** add the following line to your environment.rb: config.gem 'acts_as_commentable' ** If using bundler then just add “gem 'acts_as_commentable'” to your Gemfile and “bundle install”

  • To install as a plugin

** Rails 3: script/plugin install github.com/jackdempsey/acts_as_commentable.git

** Rails 2: script/plugin install github.com/jackdempsey/acts_as_commentable.git -r 2.x

Generate your comment model:

** Rails 3: rails g comment

** Rails 2: script/generate comment

Then migrate your database:

rake db:migrate

Usage

* Make your ActiveRecord model act as commentable.

class Post < ActiveRecord::Base
	acts_as_commentable
end

* Add a comment to a model instance

commentable = Post.create
commentable.comments.create(:title => "First comment.", :comment => "This is the first comment.")

* Fetch comments for a commentable model:

commentable = Post.find(1)
comments = commentable.comments.recent.limit(10).all

Credits

Xelipe - This plugin is heavily influenced by Acts As Taggable.

Contributors

Jack Dempsey, Chris Eppstein, Jim Ray, Matthew Van Horn, Ole Riesenberg, ZhangJinzhu, maddox, monocle

More

www.juixe.com/techknow/index.php/2006/06/18/acts-as-commentable-plugin/ www.juixe.com/projects/acts_as_commentable

Something went wrong with that request. Please try again.