acts_as_audited_rails3 1.1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/CHANGELOG +25 -0
- data/LICENSE +19 -0
- data/README +76 -0
- data/Rakefile +60 -0
- data/VERSION +1 -0
- data/acts_as_audited.gemspec +90 -0
- data/acts_as_audited_rails3.gemspec +90 -0
- data/doc/classes/Audit.html +407 -0
- data/doc/classes/CollectiveIdea/Acts/Audited/ClassMethods.html +226 -0
- data/doc/classes/CollectiveIdea/Acts/Audited/InstanceMethods.html +330 -0
- data/doc/classes/CollectiveIdea/Acts/Audited/SingletonMethods.html +254 -0
- data/doc/created.rid +1 -0
- data/doc/files/README.html +226 -0
- data/doc/files/lib/acts_as_audited/audit_rb.html +108 -0
- data/doc/files/lib/acts_as_audited/audit_sweeper_rb.html +101 -0
- data/doc/files/lib/acts_as_audited_rb.html +129 -0
- data/doc/fr_class_index.html +30 -0
- data/doc/fr_file_index.html +30 -0
- data/doc/fr_method_index.html +47 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/acts_as_audited/audit.rb +119 -0
- data/lib/acts_as_audited/audit_sweeper.rb +37 -0
- data/lib/acts_as_audited/base.rb +316 -0
- data/lib/acts_as_audited.rb +9 -0
- data/lib/generators/audited_migration/USAGE +7 -0
- data/lib/generators/audited_migration/audited_migration_generator.rb +24 -0
- data/lib/generators/audited_migration/templates/migration.rb +29 -0
- data/lib/generators/audited_migration_update/USAGE +7 -0
- data/lib/generators/audited_migration_update/audited_migration_update_generator.rb +24 -0
- data/lib/generators/audited_migration_update/templates/migration.rb +9 -0
- data/test/acts_as_audited_test.rb +437 -0
- data/test/audit_sweeper_test.rb +31 -0
- data/test/audit_test.rb +179 -0
- data/test/db/database.yml +21 -0
- data/test/db/schema.rb +33 -0
- data/test/test_helper.rb +75 -0
- metadata +152 -0
@@ -0,0 +1,330 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: CollectiveIdea::Acts::Audited::InstanceMethods</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">CollectiveIdea::Acts::Audited::InstanceMethods</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../../files/lib/acts_as_audited_rb.html">
|
59
|
+
lib/acts_as_audited.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000015">audited_attributes</a>
|
84
|
+
<a href="#M000013">revision</a>
|
85
|
+
<a href="#M000014">revision_at</a>
|
86
|
+
<a href="#M000016">revision_with</a>
|
87
|
+
<a href="#M000012">revisions</a>
|
88
|
+
<a href="#M000010">save_without_auditing</a>
|
89
|
+
<a href="#M000011">without_auditing</a>
|
90
|
+
</div>
|
91
|
+
</div>
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
|
96
|
+
<!-- if includes -->
|
97
|
+
|
98
|
+
<div id="section">
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<!-- if method_list -->
|
108
|
+
<div id="methods">
|
109
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
110
|
+
|
111
|
+
<div id="method-M000015" class="method-detail">
|
112
|
+
<a name="M000015"></a>
|
113
|
+
|
114
|
+
<div class="method-heading">
|
115
|
+
<a href="#M000015" class="method-signature">
|
116
|
+
<span class="method-name">audited_attributes</span><span class="method-args">()</span>
|
117
|
+
</a>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<div class="method-description">
|
121
|
+
<p><a class="source-toggle" href="#"
|
122
|
+
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
123
|
+
<div class="method-source-code" id="M000015-source">
|
124
|
+
<pre>
|
125
|
+
<span class="ruby-comment cmt"># File lib/acts_as_audited.rb, line 155</span>
|
126
|
+
155: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">audited_attributes</span>
|
127
|
+
156: <span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">except</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">non_audited_columns</span>)
|
128
|
+
157: <span class="ruby-keyword kw">end</span>
|
129
|
+
</pre>
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
<div id="method-M000013" class="method-detail">
|
135
|
+
<a name="M000013"></a>
|
136
|
+
|
137
|
+
<div class="method-heading">
|
138
|
+
<a href="#M000013" class="method-signature">
|
139
|
+
<span class="method-name">revision</span><span class="method-args">(version)</span>
|
140
|
+
</a>
|
141
|
+
</div>
|
142
|
+
|
143
|
+
<div class="method-description">
|
144
|
+
<p>
|
145
|
+
Get a specific <a href="InstanceMethods.html#M000013">revision</a>
|
146
|
+
specified by the version number, or +:previous+
|
147
|
+
</p>
|
148
|
+
<p><a class="source-toggle" href="#"
|
149
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
150
|
+
<div class="method-source-code" id="M000013-source">
|
151
|
+
<pre>
|
152
|
+
<span class="ruby-comment cmt"># File lib/acts_as_audited.rb, line 146</span>
|
153
|
+
146: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">revision</span>(<span class="ruby-identifier">version</span>)
|
154
|
+
147: <span class="ruby-identifier">revision_with</span> <span class="ruby-constant">Audit</span>.<span class="ruby-identifier">reconstruct_attributes</span>(<span class="ruby-identifier">audits_to</span>(<span class="ruby-identifier">version</span>))
|
155
|
+
148: <span class="ruby-keyword kw">end</span>
|
156
|
+
</pre>
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
<div id="method-M000014" class="method-detail">
|
162
|
+
<a name="M000014"></a>
|
163
|
+
|
164
|
+
<div class="method-heading">
|
165
|
+
<a href="#M000014" class="method-signature">
|
166
|
+
<span class="method-name">revision_at</span><span class="method-args">(date_or_time)</span>
|
167
|
+
</a>
|
168
|
+
</div>
|
169
|
+
|
170
|
+
<div class="method-description">
|
171
|
+
<p><a class="source-toggle" href="#"
|
172
|
+
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
173
|
+
<div class="method-source-code" id="M000014-source">
|
174
|
+
<pre>
|
175
|
+
<span class="ruby-comment cmt"># File lib/acts_as_audited.rb, line 150</span>
|
176
|
+
150: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">revision_at</span>(<span class="ruby-identifier">date_or_time</span>)
|
177
|
+
151: <span class="ruby-identifier">audits</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">audits</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">></span> [<span class="ruby-value str">"created_at <= ?"</span>, <span class="ruby-identifier">date_or_time</span>])
|
178
|
+
152: <span class="ruby-identifier">revision_with</span> <span class="ruby-constant">Audit</span>.<span class="ruby-identifier">reconstruct_attributes</span>(<span class="ruby-identifier">audits</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">audits</span>.<span class="ruby-identifier">empty?</span>
|
179
|
+
153: <span class="ruby-keyword kw">end</span>
|
180
|
+
</pre>
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
</div>
|
184
|
+
|
185
|
+
<div id="method-M000012" class="method-detail">
|
186
|
+
<a name="M000012"></a>
|
187
|
+
|
188
|
+
<div class="method-heading">
|
189
|
+
<a href="#M000012" class="method-signature">
|
190
|
+
<span class="method-name">revisions</span><span class="method-args">(from_version = 1)</span>
|
191
|
+
</a>
|
192
|
+
</div>
|
193
|
+
|
194
|
+
<div class="method-description">
|
195
|
+
<p>
|
196
|
+
Gets an array of the <a href="InstanceMethods.html#M000012">revisions</a>
|
197
|
+
available
|
198
|
+
</p>
|
199
|
+
<pre>
|
200
|
+
user.revisions.each do |revision|
|
201
|
+
user.name
|
202
|
+
user.version
|
203
|
+
end
|
204
|
+
</pre>
|
205
|
+
<p><a class="source-toggle" href="#"
|
206
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
207
|
+
<div class="method-source-code" id="M000012-source">
|
208
|
+
<pre>
|
209
|
+
<span class="ruby-comment cmt"># File lib/acts_as_audited.rb, line 138</span>
|
210
|
+
138: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">revisions</span>(<span class="ruby-identifier">from_version</span> = <span class="ruby-value">1</span>)
|
211
|
+
139: <span class="ruby-identifier">audits</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">audits</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">></span> [<span class="ruby-value str">'version >= ?'</span>, <span class="ruby-identifier">from_version</span>])
|
212
|
+
140: <span class="ruby-keyword kw">return</span> [] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">audits</span>.<span class="ruby-identifier">empty?</span>
|
213
|
+
141: <span class="ruby-identifier">revision</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">audits</span>.<span class="ruby-identifier">find_by_version</span>(<span class="ruby-identifier">from_version</span>).<span class="ruby-identifier">revision</span>
|
214
|
+
142: <span class="ruby-constant">Audit</span>.<span class="ruby-identifier">reconstruct_attributes</span>(<span class="ruby-identifier">audits</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">attrs</span><span class="ruby-operator">|</span> <span class="ruby-identifier">revision</span>.<span class="ruby-identifier">revision_with</span>(<span class="ruby-identifier">attrs</span>) }
|
215
|
+
143: <span class="ruby-keyword kw">end</span>
|
216
|
+
</pre>
|
217
|
+
</div>
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
|
221
|
+
<div id="method-M000010" class="method-detail">
|
222
|
+
<a name="M000010"></a>
|
223
|
+
|
224
|
+
<div class="method-heading">
|
225
|
+
<a href="#M000010" class="method-signature">
|
226
|
+
<span class="method-name">save_without_auditing</span><span class="method-args">()</span>
|
227
|
+
</a>
|
228
|
+
</div>
|
229
|
+
|
230
|
+
<div class="method-description">
|
231
|
+
<p>
|
232
|
+
Temporarily turns off auditing while saving.
|
233
|
+
</p>
|
234
|
+
<p><a class="source-toggle" href="#"
|
235
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
236
|
+
<div class="method-source-code" id="M000010-source">
|
237
|
+
<pre>
|
238
|
+
<span class="ruby-comment cmt"># File lib/acts_as_audited.rb, line 117</span>
|
239
|
+
117: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save_without_auditing</span>
|
240
|
+
118: <span class="ruby-identifier">without_auditing</span> { <span class="ruby-identifier">save</span> }
|
241
|
+
119: <span class="ruby-keyword kw">end</span>
|
242
|
+
</pre>
|
243
|
+
</div>
|
244
|
+
</div>
|
245
|
+
</div>
|
246
|
+
|
247
|
+
<div id="method-M000011" class="method-detail">
|
248
|
+
<a name="M000011"></a>
|
249
|
+
|
250
|
+
<div class="method-heading">
|
251
|
+
<a href="#M000011" class="method-signature">
|
252
|
+
<span class="method-name">without_auditing</span><span class="method-args">(&block)</span>
|
253
|
+
</a>
|
254
|
+
</div>
|
255
|
+
|
256
|
+
<div class="method-description">
|
257
|
+
<p>
|
258
|
+
Executes the block with the auditing callbacks disabled.
|
259
|
+
</p>
|
260
|
+
<pre>
|
261
|
+
@foo.without_auditing do
|
262
|
+
@foo.save
|
263
|
+
end
|
264
|
+
</pre>
|
265
|
+
<p><a class="source-toggle" href="#"
|
266
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
267
|
+
<div class="method-source-code" id="M000011-source">
|
268
|
+
<pre>
|
269
|
+
<span class="ruby-comment cmt"># File lib/acts_as_audited.rb, line 127</span>
|
270
|
+
127: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">without_auditing</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
271
|
+
128: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">without_auditing</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
272
|
+
129: <span class="ruby-keyword kw">end</span>
|
273
|
+
</pre>
|
274
|
+
</div>
|
275
|
+
</div>
|
276
|
+
</div>
|
277
|
+
|
278
|
+
<h3 class="section-bar">Protected Instance methods</h3>
|
279
|
+
|
280
|
+
<div id="method-M000016" class="method-detail">
|
281
|
+
<a name="M000016"></a>
|
282
|
+
|
283
|
+
<div class="method-heading">
|
284
|
+
<a href="#M000016" class="method-signature">
|
285
|
+
<span class="method-name">revision_with</span><span class="method-args">(attributes)</span>
|
286
|
+
</a>
|
287
|
+
</div>
|
288
|
+
|
289
|
+
<div class="method-description">
|
290
|
+
<p><a class="source-toggle" href="#"
|
291
|
+
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
292
|
+
<div class="method-source-code" id="M000016-source">
|
293
|
+
<pre>
|
294
|
+
<span class="ruby-comment cmt"># File lib/acts_as_audited.rb, line 161</span>
|
295
|
+
161: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">revision_with</span>(<span class="ruby-identifier">attributes</span>)
|
296
|
+
162: <span class="ruby-identifier">returning</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">revision</span><span class="ruby-operator">|</span>
|
297
|
+
163: <span class="ruby-identifier">revision</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">:instance_variable_set</span>, <span class="ruby-value str">'@attributes'</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">attributes_before_type_cast</span>
|
298
|
+
164: <span class="ruby-constant">Audit</span>.<span class="ruby-identifier">assign_revision_attributes</span>(<span class="ruby-identifier">revision</span>, <span class="ruby-identifier">attributes</span>)
|
299
|
+
165:
|
300
|
+
166: <span class="ruby-comment cmt"># Remove any association proxies so that they will be recreated</span>
|
301
|
+
167: <span class="ruby-comment cmt"># and reference the correct object for this revision. The only way</span>
|
302
|
+
168: <span class="ruby-comment cmt"># to determine if an instance variable is a proxy object is to</span>
|
303
|
+
169: <span class="ruby-comment cmt"># see if it responds to certain methods, as it forwards almost</span>
|
304
|
+
170: <span class="ruby-comment cmt"># everything to its target.</span>
|
305
|
+
171: <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">ivar</span> <span class="ruby-keyword kw">in</span> <span class="ruby-identifier">revision</span>.<span class="ruby-identifier">instance_variables</span>
|
306
|
+
172: <span class="ruby-identifier">proxy</span> = <span class="ruby-identifier">revision</span>.<span class="ruby-identifier">instance_variable_get</span> <span class="ruby-identifier">ivar</span>
|
307
|
+
173: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">proxy</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">proxy</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:proxy_respond_to?</span>
|
308
|
+
174: <span class="ruby-identifier">revision</span>.<span class="ruby-identifier">instance_variable_set</span> <span class="ruby-identifier">ivar</span>, <span class="ruby-keyword kw">nil</span>
|
309
|
+
175: <span class="ruby-keyword kw">end</span>
|
310
|
+
176: <span class="ruby-keyword kw">end</span>
|
311
|
+
177: <span class="ruby-keyword kw">end</span>
|
312
|
+
178: <span class="ruby-keyword kw">end</span>
|
313
|
+
</pre>
|
314
|
+
</div>
|
315
|
+
</div>
|
316
|
+
</div>
|
317
|
+
|
318
|
+
|
319
|
+
</div>
|
320
|
+
|
321
|
+
|
322
|
+
</div>
|
323
|
+
|
324
|
+
|
325
|
+
<div id="validator-badges">
|
326
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
327
|
+
</div>
|
328
|
+
|
329
|
+
</body>
|
330
|
+
</html>
|
@@ -0,0 +1,254 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: CollectiveIdea::Acts::Audited::SingletonMethods</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">CollectiveIdea::Acts::Audited::SingletonMethods</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../../files/lib/acts_as_audited_rb.html">
|
59
|
+
lib/acts_as_audited.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000021">audit_as</a>
|
84
|
+
<a href="#M000017">audited_columns</a>
|
85
|
+
<a href="#M000019">disable_auditing</a>
|
86
|
+
<a href="#M000020">enable_auditing</a>
|
87
|
+
<a href="#M000018">without_auditing</a>
|
88
|
+
</div>
|
89
|
+
</div>
|
90
|
+
|
91
|
+
</div>
|
92
|
+
|
93
|
+
|
94
|
+
<!-- if includes -->
|
95
|
+
|
96
|
+
<div id="section">
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
<!-- if method_list -->
|
106
|
+
<div id="methods">
|
107
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
108
|
+
|
109
|
+
<div id="method-M000021" class="method-detail">
|
110
|
+
<a name="M000021"></a>
|
111
|
+
|
112
|
+
<div class="method-heading">
|
113
|
+
<a href="#M000021" class="method-signature">
|
114
|
+
<span class="method-name">audit_as</span><span class="method-args">( user, &block )</span>
|
115
|
+
</a>
|
116
|
+
</div>
|
117
|
+
|
118
|
+
<div class="method-description">
|
119
|
+
<p>
|
120
|
+
All audit operations during the block are recorded as being made by
|
121
|
+
<tt>user</tt>. This is not model specific, the method is a convenience
|
122
|
+
wrapper around <a href="../../../Audit.html">Audit</a>.as_user.
|
123
|
+
</p>
|
124
|
+
<p><a class="source-toggle" href="#"
|
125
|
+
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
126
|
+
<div class="method-source-code" id="M000021-source">
|
127
|
+
<pre>
|
128
|
+
<span class="ruby-comment cmt"># File lib/acts_as_audited.rb, line 269</span>
|
129
|
+
269: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">audit_as</span>( <span class="ruby-identifier">user</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
130
|
+
270: <span class="ruby-constant">Audit</span>.<span class="ruby-identifier">as_user</span>( <span class="ruby-identifier">user</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
131
|
+
271: <span class="ruby-keyword kw">end</span>
|
132
|
+
</pre>
|
133
|
+
</div>
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
<div id="method-M000017" class="method-detail">
|
138
|
+
<a name="M000017"></a>
|
139
|
+
|
140
|
+
<div class="method-heading">
|
141
|
+
<a href="#M000017" class="method-signature">
|
142
|
+
<span class="method-name">audited_columns</span><span class="method-args">()</span>
|
143
|
+
</a>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
<div class="method-description">
|
147
|
+
<p>
|
148
|
+
Returns an array of columns that are audited. See non_audited_columns
|
149
|
+
</p>
|
150
|
+
<p><a class="source-toggle" href="#"
|
151
|
+
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
152
|
+
<div class="method-source-code" id="M000017-source">
|
153
|
+
<pre>
|
154
|
+
<span class="ruby-comment cmt"># File lib/acts_as_audited.rb, line 242</span>
|
155
|
+
242: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">audited_columns</span>
|
156
|
+
243: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">columns</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-operator">!</span><span class="ruby-identifier">non_audited_columns</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">c</span>.<span class="ruby-identifier">name</span>) }
|
157
|
+
244: <span class="ruby-keyword kw">end</span>
|
158
|
+
</pre>
|
159
|
+
</div>
|
160
|
+
</div>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
<div id="method-M000019" class="method-detail">
|
164
|
+
<a name="M000019"></a>
|
165
|
+
|
166
|
+
<div class="method-heading">
|
167
|
+
<a href="#M000019" class="method-signature">
|
168
|
+
<span class="method-name">disable_auditing</span><span class="method-args">()</span>
|
169
|
+
</a>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
<div class="method-description">
|
173
|
+
<p><a class="source-toggle" href="#"
|
174
|
+
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
175
|
+
<div class="method-source-code" id="M000019-source">
|
176
|
+
<pre>
|
177
|
+
<span class="ruby-comment cmt"># File lib/acts_as_audited.rb, line 258</span>
|
178
|
+
258: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">disable_auditing</span>
|
179
|
+
259: <span class="ruby-identifier">write_inheritable_attribute</span> <span class="ruby-identifier">:auditing_enabled</span>, <span class="ruby-keyword kw">false</span>
|
180
|
+
260: <span class="ruby-keyword kw">end</span>
|
181
|
+
</pre>
|
182
|
+
</div>
|
183
|
+
</div>
|
184
|
+
</div>
|
185
|
+
|
186
|
+
<div id="method-M000020" class="method-detail">
|
187
|
+
<a name="M000020"></a>
|
188
|
+
|
189
|
+
<div class="method-heading">
|
190
|
+
<a href="#M000020" class="method-signature">
|
191
|
+
<span class="method-name">enable_auditing</span><span class="method-args">()</span>
|
192
|
+
</a>
|
193
|
+
</div>
|
194
|
+
|
195
|
+
<div class="method-description">
|
196
|
+
<p><a class="source-toggle" href="#"
|
197
|
+
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
198
|
+
<div class="method-source-code" id="M000020-source">
|
199
|
+
<pre>
|
200
|
+
<span class="ruby-comment cmt"># File lib/acts_as_audited.rb, line 262</span>
|
201
|
+
262: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">enable_auditing</span>
|
202
|
+
263: <span class="ruby-identifier">write_inheritable_attribute</span> <span class="ruby-identifier">:auditing_enabled</span>, <span class="ruby-keyword kw">true</span>
|
203
|
+
264: <span class="ruby-keyword kw">end</span>
|
204
|
+
</pre>
|
205
|
+
</div>
|
206
|
+
</div>
|
207
|
+
</div>
|
208
|
+
|
209
|
+
<div id="method-M000018" class="method-detail">
|
210
|
+
<a name="M000018"></a>
|
211
|
+
|
212
|
+
<div class="method-heading">
|
213
|
+
<a href="#M000018" class="method-signature">
|
214
|
+
<span class="method-name">without_auditing</span><span class="method-args">(&block)</span>
|
215
|
+
</a>
|
216
|
+
</div>
|
217
|
+
|
218
|
+
<div class="method-description">
|
219
|
+
<p>
|
220
|
+
Executes the block with auditing disabled.
|
221
|
+
</p>
|
222
|
+
<pre>
|
223
|
+
Foo.without_auditing do
|
224
|
+
@foo.save
|
225
|
+
end
|
226
|
+
</pre>
|
227
|
+
<p><a class="source-toggle" href="#"
|
228
|
+
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
229
|
+
<div class="method-source-code" id="M000018-source">
|
230
|
+
<pre>
|
231
|
+
<span class="ruby-comment cmt"># File lib/acts_as_audited.rb, line 252</span>
|
232
|
+
252: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">without_auditing</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
233
|
+
253: <span class="ruby-identifier">auditing_was_enabled</span> = <span class="ruby-identifier">auditing_enabled</span>
|
234
|
+
254: <span class="ruby-identifier">disable_auditing</span>
|
235
|
+
255: <span class="ruby-identifier">returning</span>(<span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>) { <span class="ruby-identifier">enable_auditing</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">auditing_was_enabled</span> }
|
236
|
+
256: <span class="ruby-keyword kw">end</span>
|
237
|
+
</pre>
|
238
|
+
</div>
|
239
|
+
</div>
|
240
|
+
</div>
|
241
|
+
|
242
|
+
|
243
|
+
</div>
|
244
|
+
|
245
|
+
|
246
|
+
</div>
|
247
|
+
|
248
|
+
|
249
|
+
<div id="validator-badges">
|
250
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
251
|
+
</div>
|
252
|
+
|
253
|
+
</body>
|
254
|
+
</html>
|
data/doc/created.rid
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Mon, 14 Dec 2009 23:54:19 -0500
|