Skip to content

This is a simple Rails plug-in that allows adding content reporting compatibilities to your models

License

Notifications You must be signed in to change notification settings

aprihodko/acts_as_reportable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Install
 * Run the following command:
 
	script/plugin install git://github.com/aprihodko/acts_as_reportable.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
    end
  
    add_index "content_reports", ["user_id"], :name => "fk_content_reports_user"
  end

  def self.down
    drop_table :content_reports
  end

== Usage
 
 * Make you ActiveRecord model act as reportable.
 
 class Model < ActiveRecord::Base
 	acts_as_reportable
 end
 
 * Add a content_report to a model instance
 
 model = Model.new
 content_report = ContentReport.new
 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


About

This is a simple Rails plug-in that allows adding content reporting compatibilities to your models

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages