Skip to content
mrbrdo edited this page Oct 14, 2012 · 8 revisions

To see pending moderations, simply call

Moderation.all

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
post.moderations

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

moderation.parsed_data

To accept a moderation, call

moderation.accept

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.

To discard (destroy) the moderation, call

moderation.discard

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

moderation.create?
moderation.destroy?
moderation.update?