Strongly inspired by acts_as_flaggable.
Intended to allow your users to flag content as inappropriate, and set up some ways for you
to deal with the content.
1. Download the tarball from github, or, clone the repository and symlink it into your application.
Yes, I'm serious.
2. $ script/generate can_flag flags
This will create the following files:
3. Modify any content model with
class Article < ActiveRecord::Base
You can also add a callback
# send an email
# delete this post
# suspend the owner of the post if the flags.size > 3
# suspend the owner of the post if their total flags count > 5
4. Modify your user model with
class User < ActiveRecord::Base
article = Article.find(4)
current_user.flags.create :flaggable => article
* When a flag is added via add_flag, flagged(flag, flag_count) is called
on the flaggable model. This allows the model to perform certain
operations if the number of flags reaches a certain point. For example,
you may want to mark a Post as deleted if a Post receives too many "spam"
* Each flag reference flaggable object
model = Model.find(1)
model.flags.get(0).commtable == model