0.02
No release in over 3 years
Low commit activity in last 3 years
Moderated fields or whole model instances are serialized and saved into a separate moderations table. The moderation can then be accepted and the changes will be applied to the model. This way, lookups for existing, accepted fields or entries will be much faster than if using something like Papertrail, since the changes that have not yet been accepted are stored outside of the model table - in the moderations table.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 3.0.0
 Project Readme

HasModerated¶ ↑

<img src=“https://secure.travis-ci.org/mrbrdo/has_moderated.png?branch=master” alt=“Build Status” />

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: 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.