has_moderated 1.0.beta2 → 1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +8 -0
- data/lib/has_moderated/moderation_model.rb +12 -0
- data/lib/has_moderated/version.rb +1 -1
- data/test/dummy/log/development.log +1 -0
- data/test/dummy/log/test.log +2474 -0
- data/test/dummy/spec/models/task_spec.rb +30 -3
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -119,6 +119,14 @@ This will return the record with modified attributes, but not saved to database.
|
|
119
119
|
|
120
120
|
Just be careful not to call record_preview.save, as this will create a new moderation record.
|
121
121
|
|
122
|
+
== Which kind of moderation is it?
|
123
|
+
|
124
|
+
You can call the following convenience methods to determine the type of moderation
|
125
|
+
|
126
|
+
moderation.create?
|
127
|
+
moderation.destroy?
|
128
|
+
moderation.update?
|
129
|
+
|
122
130
|
== Bypassing moderation
|
123
131
|
To bypass moderation (e.g. for admin users), wrap your code into without_moderation like so:
|
124
132
|
|
@@ -24,5 +24,17 @@ module HasModerated
|
|
24
24
|
def preview
|
25
25
|
HasModerated::ModeratedAttributes::ApplyModeration::apply(self, parsed_data, false)
|
26
26
|
end
|
27
|
+
|
28
|
+
def create?
|
29
|
+
parsed_data[:create].present?
|
30
|
+
end
|
31
|
+
|
32
|
+
def destroy?
|
33
|
+
parsed_data.to_s == "destroy"
|
34
|
+
end
|
35
|
+
|
36
|
+
def update?
|
37
|
+
!(create? || destroy?)
|
38
|
+
end
|
27
39
|
end
|
28
40
|
end
|
@@ -7541,3 +7541,4 @@ Migrating to CreatePhotos (20120520215224)
|
|
7541
7541
|
[1m[35m (0.0ms)[0m PRAGMA index_list("task_photos")
|
7542
7542
|
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("tasks")[0m
|
7543
7543
|
[1m[35m (0.0ms)[0m PRAGMA index_list("tasks_jointable")
|
7544
|
+
DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from /Users/apple/rails/has_moderated/test/dummy/config/environment.rb:5)
|