Manage moderations

khuenping edited this page Aug 26, 2013 · 8 revisions

To see pending moderations, simply call


You can also see moderations for a specific record. For example, if you have Post model, you can call moderations on it.

post = Post.first

Moderation is a normal ActiveRecord model, you can inspect it in rails console to see what it holds. The data can be deserialized using YAML::load, but this has already been done for you

post = Post.first
moderation = post.moderations.first

The above method assumes there is only one awaiting for moderation for that post. To accept a moderation, call


The accept method will return false (v1.1+) if model validations do not pass. You can also call accept! which will raise an exception in this case. You can pass options to accept that will be passed on to model#save, for example if you don't want to run validations when accepting the moderation:

moderation.accept(:perform_validation => false)

To discard (destroy) the moderation, call


Do not use moderation.destroy, because discard triggers certain callbacks which may be necessary (especially for carrierwave uploads).

Which kind of moderation is it?

You can call the following convenience methods to determine the type of moderation