I now have the acts_as_commentable plugin up on RubyForge. This
plugin will allow you to add comments to any active_record object in
your Rails application.
So far the directions are simple, and there are only a few features:
ruby script/plugin install
In the readme there is a sample migration you will need to use, with
directions on how to modify it if need be. I’m still learning how the
plugins work, and do not know if there is a way to autogenerate this.
Once the migration is completed and ran, you can just add:
acts_as_commentable to those objects you want to comment on and you’re
Lets say you have a Person object:
class Person < ActiveRecord::Base
Then you have a person:
p = Person.find(:first)
Create a comment:
c = Comment.new
Fill out the comment
c.name = “Name of Commentor”
c.content = “What they wrote”
then add it to your object:
to remove a comment:
I think that’s everything. This was done quick and dirty, If there
are things you would like to see in this, let me know. I don’t know
if there is much more to do that wouldn’t be application specific.