You are here: Browse Railsplugins Acts As Commentable
Allows for comments to be added to multiple and different models.
ResourcesInstall * Run the following command:
script/plugin install http://juixe.com/svn/acts_as_commentable
def self.up create_table “comments”, :force => true do |t| t.column “title”, :string, :limit => 50, :default => ”” t.column “comment”, :text, :default => ”” t.column “created_at”, :datetime, :null => false t.column “commentable_id”, :integer, :default => 0, :null => false t.column “commentable_type”, :string, :limit => 15, :default => ””, :null => false t.column “user_id”, :integer, :default => 0, :null => false end end
add_index "comments", ["user_id"], :name => "fk_comments_user"
def self.down drop_table :comments end
Usage
class Model < ActiveRecord::Base
acts_as_commentable
end
model = Model.new
comment = Comment.new
comment.comment = 'Some comment'
model.comments << comment
model = Model.find(1)
model.comments.get(0).commtable model
Credits
Xelipe – This plugin is heavily influced by Acts As Tagglable.
Morehttp://www.juixe.com/techknow/index.php/2006/06/18/acts-as-commentable-plugin/ http://www.juixe.com/projects/acts_as_commentable
NOTE: This description has been extracted from the Plugin README and so the formatting may need updating to make browser friendly