🚩
🛡️

ContentFlagging Ruby Gem

The easiest way to add content moderation to your Rails app. Install the gem, add one line to your model, and get automatic content flagging with zero configuration.

Gem Version Ruby Version Rails Version License

💎 Install ContentFlagging Gem

Add content moderation to your Rails app in seconds

gem install content_flagging

⚡ Quick Start

1. Add to Gemfile

# Gemfile
gem 'content_flagging'

2. Install & Migrate

rails generate content_flagging:install
rails db:migrate

3. Add to Model

class Post < ApplicationRecord
  acts_as_flaggable  # 🎯 That's it!
end

🎯 See The Magic

rails console
> post = Post.create(title: "Controversial Content")
=> #<Post id: 1, title: "Controversial Content">
> post.flag!(flagged_by: user1)
=> Flag 1/3
> post.flag!(flagged_by: user2)
=> Flag 2/3
> post.flag!(flagged_by: user3)
💥 BOOM! Post HIDDEN from Post.all

🔥 Why Choose ContentFlagging?

🎯

Zero Config

Works out of the box with sensible defaults

Just add acts_as_flaggable!
🚀

Performance

Efficient queries with proper indexing

🔒

Thread-Safe

Database-level counters prevent race conditions

👥

User Flagging

Users can flag inappropriate content

🎨

Flexible

Flag anything - posts, comments, users, you name it

🛡️

Admin-Friendly

Easy oversight and management tools

🚀 Interactive Demo

🚩
0 Flags
🎯
3 Threshold
👁️
Visible Status
Demo Console
🚀 Interactive demo ready!
Click 'Create Post' to start the demonstration.

📖 API Reference

Instance Methods

flag!(flagged_by: user)Flag content
unflag!(flagged_by: user)Remove flag
flagged?Check if flagged
flag_countNumber of flags
flagged_atWhen first flagged

Scopes

Model.allClean content (default)
Model.with_flaggedEverything
Model.flaggedOnly flagged
Model.not_flaggedExplicitly clean