has_moderated icon indicating copy to clipboard operation
has_moderated copied to clipboard

Rails 3.x gem for moderating ActiveRecord models (like posts, attributes...).

= HasModerated {Build Status}[http://travis-ci.org/mrbrdo/has_moderated]

== Installing

Add it to your project's Gemfile

gem "has_moderated"

and run

bundle install

To set up has_moderated in your project, use

rails generate has_moderated:install

rake db:migrate

This will generate a Moderation model and a migration for it.

== Upgrading

When upgrading, rerun the generator

rails generate has_moderated:install

If you are upgrading from a version lower than 1.0.x you need to remove the old create_moderations migration file.

Make sure you have reviewed and accepted/declined all current moderations before upgrading! This means the moderations table in database should be empty, otherwise the migration process might fail (on purpose).

== Documentation

To learn how to use has_moderated, have a look at the wiki: https://github.com/mrbrdo/has_moderated/wiki

== Tests

I've tested this project using RSpec. You can find the tests in

test/dummy/spec/models/task_spec.rb test/dummy/spec/models/photo_spec.rb

You can run the tests by running

rake spec

in the root directory of this gem (so you have to clone it first).

== Problems

If you have problems open an issue here on Github.

You may encounter problems with models that have some sort of non-serializable attributes. This might be something like file attachments, you'll have to try it to see. If you have a problem like that you can extract the problematic attributes into a seperate has_one association. If you moderate create, save that model without the foreign key first, and then use has_moderated_create :with_associations => [:association_name] and add the association (to the existing associated model) before saving the moderated model. If you have questions about this or don't understand what I mean, open an issue here at GitHub and I will explain it further.

It is also possible you will encounter problems with some heavily customized associations, or with has_many :through associations (although I have tested this for a simple, ordinary case and it works). If that happens open an issue here on Github.

== License

This project rocks and uses MIT-LICENSE.