Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
62 lines (41 sloc) 1.71 KB
Acts As Reportable
Allows content reports to be added to your models.
With this plug-in you will allow users marking content as Offensive, Inappropriate, Spam, Pornography, etc.
To make your own content types, just override the ContentReport.content_report_types array with your items.
== Resources
* Run the following command:
script/plugin install git://
* Create a new rails migration and add the following self.up and self.down methods
def self.up
create_table "content_reports", :force => true do |t|
t.column "content_type", :int, :default => 0
t.column "comment", :string, :limit => 255, :default => ""
t.column "reportable_type", :string, :limit => 15, :default => "", :null => false
t.column "reportable_id", :integer, :default => 0, :null => false
t.column "user_id", :integer, :default => 0, :null => false
t.column "created_at", :datetime, :null => false
add_index "content_reports", ["user_id"], :name => "fk_content_reports_user"
def self.down
drop_table :content_reports
== Usage
* Make you ActiveRecord model act as reportable.
class Model < ActiveRecord::Base
* Add a content_report to a model instance
model =
content_report =
content_report.type = 1 # should be any value of the ContentReport.content_report_types array
content_report.content = 'Some comment'
model.content_reports << content_report
* Each content_report reference reportable object
model = Model.find(1)
model.content_reports.get(0).reportable == model
== Credits
This plugin is very similar to Acts As Commentable.
== More