magic_userstamp 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +78 -8
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/init.rb +5 -7
- data/lib/magic_userstamp.rb +27 -0
- data/lib/{userstamp → magic_userstamp}/config.rb +11 -12
- data/lib/{userstamp → magic_userstamp}/controller.rb +2 -2
- data/lib/{userstamp → magic_userstamp}/event.rb +3 -3
- data/lib/{userstamp → magic_userstamp}/magic_columns.rb +3 -3
- data/lib/magic_userstamp/migration_helper.rb +17 -0
- data/lib/{userstamp → magic_userstamp}/stampable.rb +15 -15
- data/lib/{userstamp → magic_userstamp}/stamper.rb +5 -5
- data/magic_userstamp.gemspec +36 -29
- data/rdoc/classes/MagicUserstamp.html +233 -0
- data/rdoc/classes/MagicUserstamp/Config.html +408 -0
- data/rdoc/classes/MagicUserstamp/Config/Pattern.html +246 -0
- data/rdoc/classes/{Ddb → MagicUserstamp}/Controller.html +7 -7
- data/rdoc/classes/{Ddb/Controller/Userstamp → MagicUserstamp/Controller}/InstanceMethods.html +7 -7
- data/rdoc/classes/MagicUserstamp/Event.html +367 -0
- data/rdoc/classes/MagicUserstamp/MagicColumns.html +180 -0
- data/rdoc/classes/MagicUserstamp/MagicColumns/ClassMethods.html +225 -0
- data/rdoc/classes/MagicUserstamp/MagicUserstampError.html +111 -0
- data/rdoc/classes/{Ddb/Userstamp → MagicUserstamp}/MigrationHelper.html +8 -8
- data/rdoc/classes/MagicUserstamp/MigrationHelper/InstanceMethods.html +142 -0
- data/rdoc/classes/MagicUserstamp/Stampable.html +157 -0
- data/rdoc/classes/MagicUserstamp/Stampable/ClassMethods.html +259 -0
- data/rdoc/classes/{Ddb/Userstamp → MagicUserstamp}/Stamper.html +9 -9
- data/rdoc/classes/{Ddb/Userstamp → MagicUserstamp}/Stamper/ClassMethods.html +19 -19
- data/rdoc/classes/MagicUserstamp/Stamper/InstanceMethods.html +208 -0
- data/rdoc/created.rid +1 -1
- data/rdoc/files/README_rdoc.html +268 -0
- data/rdoc/files/lib/magic_userstamp/config_rb.html +108 -0
- data/rdoc/files/lib/magic_userstamp/controller_rb.html +108 -0
- data/rdoc/files/lib/{userstamp_rb.html → magic_userstamp/event_rb.html} +14 -7
- data/rdoc/files/lib/magic_userstamp/magic_columns_rb.html +108 -0
- data/rdoc/files/lib/{migration_helper_rb.html → magic_userstamp/migration_helper_rb.html} +12 -5
- data/rdoc/files/lib/magic_userstamp/stampable_rb.html +108 -0
- data/rdoc/files/lib/{stamper_rb.html → magic_userstamp/stamper_rb.html} +12 -5
- data/rdoc/files/lib/{stampable_rb.html → magic_userstamp_rb.html} +6 -6
- data/rdoc/fr_class_index.html +18 -13
- data/rdoc/fr_file_index.html +11 -9
- data/rdoc/fr_method_index.html +39 -9
- data/rdoc/index.html +7 -5
- data/spec/compatibility_stamping_spec.rb +3 -3
- data/spec/config_spec.rb +5 -5
- data/spec/magic_column_spec.rb +8 -8
- data/spec/resources/controllers/magic_userstamp_controller.rb +9 -0
- data/spec/resources/controllers/posts_controller.rb +2 -2
- data/spec/resources/controllers/users_controller.rb +2 -2
- data/spec/stamping_spec.rb +1 -1
- metadata +36 -29
- data/lib/userstamp.rb +0 -17
- data/lib/userstamp/migration_helper.rb +0 -17
- data/rdoc/classes/Ddb/Controller/Userstamp.html +0 -125
- data/rdoc/classes/Ddb/Userstamp.html +0 -121
- data/rdoc/classes/Ddb/Userstamp/MigrationHelper/InstanceMethods.html +0 -142
- data/rdoc/classes/Ddb/Userstamp/Stampable.html +0 -128
- data/rdoc/classes/Ddb/Userstamp/Stampable/ClassMethods.html +0 -222
- data/rdoc/classes/Ddb/Userstamp/Stamper/InstanceMethods.html +0 -207
- data/rdoc/files/CHANGELOG.html +0 -137
- data/rdoc/files/LICENSE.html +0 -129
- data/rdoc/files/README.html +0 -341
- data/spec/resources/controllers/userstamp_controller.rb +0 -9
@@ -1,222 +0,0 @@
|
|
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: Ddb::Userstamp::Stampable::ClassMethods</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">Ddb::Userstamp::Stampable::ClassMethods</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../../../files/lib/stampable_rb.html">
|
59
|
-
lib/stampable.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="#M000005">stampable</a>
|
84
|
-
<a href="#M000006">without_stamps</a>
|
85
|
-
</div>
|
86
|
-
</div>
|
87
|
-
|
88
|
-
</div>
|
89
|
-
|
90
|
-
|
91
|
-
<!-- if includes -->
|
92
|
-
|
93
|
-
<div id="section">
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
<!-- if method_list -->
|
103
|
-
<div id="methods">
|
104
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
105
|
-
|
106
|
-
<div id="method-M000005" class="method-detail">
|
107
|
-
<a name="M000005"></a>
|
108
|
-
|
109
|
-
<div class="method-heading">
|
110
|
-
<a href="#M000005" class="method-signature">
|
111
|
-
<span class="method-name">stampable</span><span class="method-args">(options = {})</span>
|
112
|
-
</a>
|
113
|
-
</div>
|
114
|
-
|
115
|
-
<div class="method-description">
|
116
|
-
<p>
|
117
|
-
This method is automatically called on for all classes that inherit from
|
118
|
-
ActiveRecord, but if you need to customize how the plug-in functions, this
|
119
|
-
is the method to use. Here‘s an example:
|
120
|
-
</p>
|
121
|
-
<pre>
|
122
|
-
class Post < ActiveRecord::Base
|
123
|
-
stampable :stamper_class_name => :person,
|
124
|
-
:creator_attribute => :create_user,
|
125
|
-
:updater_attribute => :update_user,
|
126
|
-
:deleter_attribute => :delete_user
|
127
|
-
end
|
128
|
-
</pre>
|
129
|
-
<p>
|
130
|
-
The method will automatically setup all the associations, and create
|
131
|
-
<tt>before_save</tt> and <tt>before_create</tt> filters for doing the
|
132
|
-
stamping.
|
133
|
-
</p>
|
134
|
-
<p><a class="source-toggle" href="#"
|
135
|
-
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
136
|
-
<div class="method-source-code" id="M000005-source">
|
137
|
-
<pre>
|
138
|
-
<span class="ruby-comment cmt"># File lib/stampable.rb, line 68</span>
|
139
|
-
68: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stampable</span>(<span class="ruby-identifier">options</span> = {})
|
140
|
-
69: <span class="ruby-identifier">defaults</span> = {
|
141
|
-
70: <span class="ruby-identifier">:stamper_class_name</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:user</span>,
|
142
|
-
71: <span class="ruby-identifier">:creator_attribute</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Ddb</span><span class="ruby-operator">::</span><span class="ruby-constant">Userstamp</span>.<span class="ruby-identifier">compatibility_mode</span> <span class="ruby-value">? </span><span class="ruby-operator">:</span><span class="ruby-identifier">created_by</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:creator_id</span>,
|
143
|
-
72: <span class="ruby-identifier">:updater_attribute</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Ddb</span><span class="ruby-operator">::</span><span class="ruby-constant">Userstamp</span>.<span class="ruby-identifier">compatibility_mode</span> <span class="ruby-value">? </span><span class="ruby-operator">:</span><span class="ruby-identifier">updated_by</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:updater_id</span>,
|
144
|
-
73: <span class="ruby-identifier">:deleter_attribute</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Ddb</span><span class="ruby-operator">::</span><span class="ruby-constant">Userstamp</span>.<span class="ruby-identifier">compatibility_mode</span> <span class="ruby-value">? </span><span class="ruby-operator">:</span><span class="ruby-identifier">deleted_by</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:deleter_id</span>
|
145
|
-
74: }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
|
146
|
-
75:
|
147
|
-
76: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">stamper_class_name</span> = <span class="ruby-identifier">defaults</span>[<span class="ruby-identifier">:stamper_class_name</span>].<span class="ruby-identifier">to_sym</span>
|
148
|
-
77: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">creator_attribute</span> = <span class="ruby-identifier">defaults</span>[<span class="ruby-identifier">:creator_attribute</span>].<span class="ruby-identifier">to_sym</span>
|
149
|
-
78: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">updater_attribute</span> = <span class="ruby-identifier">defaults</span>[<span class="ruby-identifier">:updater_attribute</span>].<span class="ruby-identifier">to_sym</span>
|
150
|
-
79: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">deleter_attribute</span> = <span class="ruby-identifier">defaults</span>[<span class="ruby-identifier">:deleter_attribute</span>].<span class="ruby-identifier">to_sym</span>
|
151
|
-
80:
|
152
|
-
81: <span class="ruby-identifier">class_eval</span> <span class="ruby-keyword kw">do</span>
|
153
|
-
82: <span class="ruby-identifier">belongs_to</span> <span class="ruby-identifier">:creator</span>, <span class="ruby-identifier">:class_name</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">stamper_class_name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">singularize</span>.<span class="ruby-identifier">camelize</span>,
|
154
|
-
83: <span class="ruby-identifier">:foreign_key</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">creator_attribute</span>
|
155
|
-
84:
|
156
|
-
85: <span class="ruby-identifier">belongs_to</span> <span class="ruby-identifier">:updater</span>, <span class="ruby-identifier">:class_name</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">stamper_class_name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">singularize</span>.<span class="ruby-identifier">camelize</span>,
|
157
|
-
86: <span class="ruby-identifier">:foreign_key</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">updater_attribute</span>
|
158
|
-
87:
|
159
|
-
88: <span class="ruby-identifier">before_save</span> <span class="ruby-identifier">:set_updater_attribute</span>
|
160
|
-
89: <span class="ruby-identifier">before_create</span> <span class="ruby-identifier">:set_creator_attribute</span>
|
161
|
-
90:
|
162
|
-
91: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Caboose</span><span class="ruby-operator">::</span><span class="ruby-constant">Acts</span><span class="ruby-operator">::</span><span class="ruby-constant">Paranoid</span>)
|
163
|
-
92: <span class="ruby-identifier">belongs_to</span> <span class="ruby-identifier">:deleter</span>, <span class="ruby-identifier">:class_name</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">stamper_class_name</span>,
|
164
|
-
93: <span class="ruby-identifier">:foreign_key</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">deleter_attribute</span>
|
165
|
-
94: <span class="ruby-identifier">before_destroy</span> <span class="ruby-identifier">:set_deleter_attribute</span>
|
166
|
-
95: <span class="ruby-keyword kw">end</span>
|
167
|
-
96: <span class="ruby-keyword kw">end</span>
|
168
|
-
97: <span class="ruby-keyword kw">end</span>
|
169
|
-
</pre>
|
170
|
-
</div>
|
171
|
-
</div>
|
172
|
-
</div>
|
173
|
-
|
174
|
-
<div id="method-M000006" class="method-detail">
|
175
|
-
<a name="M000006"></a>
|
176
|
-
|
177
|
-
<div class="method-heading">
|
178
|
-
<a href="#M000006" class="method-signature">
|
179
|
-
<span class="method-name">without_stamps</span><span class="method-args">() {|| ...}</span>
|
180
|
-
</a>
|
181
|
-
</div>
|
182
|
-
|
183
|
-
<div class="method-description">
|
184
|
-
<p>
|
185
|
-
Temporarily allows you to turn stamping off. For example:
|
186
|
-
</p>
|
187
|
-
<pre>
|
188
|
-
Post.without_stamps do
|
189
|
-
post = Post.find(params[:id])
|
190
|
-
post.update_attributes(params[:post])
|
191
|
-
post.save
|
192
|
-
end
|
193
|
-
</pre>
|
194
|
-
<p><a class="source-toggle" href="#"
|
195
|
-
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
196
|
-
<div class="method-source-code" id="M000006-source">
|
197
|
-
<pre>
|
198
|
-
<span class="ruby-comment cmt"># File lib/stampable.rb, line 106</span>
|
199
|
-
106: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">without_stamps</span>
|
200
|
-
107: <span class="ruby-identifier">original_value</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">record_userstamp</span>
|
201
|
-
108: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">record_userstamp</span> = <span class="ruby-keyword kw">false</span>
|
202
|
-
109: <span class="ruby-keyword kw">yield</span>
|
203
|
-
110: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">record_userstamp</span> = <span class="ruby-identifier">original_value</span>
|
204
|
-
111: <span class="ruby-keyword kw">end</span>
|
205
|
-
</pre>
|
206
|
-
</div>
|
207
|
-
</div>
|
208
|
-
</div>
|
209
|
-
|
210
|
-
|
211
|
-
</div>
|
212
|
-
|
213
|
-
|
214
|
-
</div>
|
215
|
-
|
216
|
-
|
217
|
-
<div id="validator-badges">
|
218
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
219
|
-
</div>
|
220
|
-
|
221
|
-
</body>
|
222
|
-
</html>
|
@@ -1,207 +0,0 @@
|
|
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: Ddb::Userstamp::Stamper::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">Ddb::Userstamp::Stamper::InstanceMethods</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../../../files/lib/stamper_rb.html">
|
59
|
-
lib/stamper.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="#M000004">reset_stamper</a>
|
84
|
-
<a href="#M000003">stamper</a>
|
85
|
-
<a href="#M000002">stamper=</a>
|
86
|
-
</div>
|
87
|
-
</div>
|
88
|
-
|
89
|
-
</div>
|
90
|
-
|
91
|
-
|
92
|
-
<!-- if includes -->
|
93
|
-
|
94
|
-
<div id="section">
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
<!-- if method_list -->
|
104
|
-
<div id="methods">
|
105
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
106
|
-
|
107
|
-
<div id="method-M000004" class="method-detail">
|
108
|
-
<a name="M000004"></a>
|
109
|
-
|
110
|
-
<div class="method-heading">
|
111
|
-
<a href="#M000004" class="method-signature">
|
112
|
-
<span class="method-name">reset_stamper</span><span class="method-args">()</span>
|
113
|
-
</a>
|
114
|
-
</div>
|
115
|
-
|
116
|
-
<div class="method-description">
|
117
|
-
<p>
|
118
|
-
Sets the <a href="InstanceMethods.html#M000003">stamper</a> back to
|
119
|
-
<tt>nil</tt> to prepare for the next request.
|
120
|
-
</p>
|
121
|
-
<p><a class="source-toggle" href="#"
|
122
|
-
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
123
|
-
<div class="method-source-code" id="M000004-source">
|
124
|
-
<pre>
|
125
|
-
<span class="ruby-comment cmt"># File lib/stamper.rb, line 35</span>
|
126
|
-
35: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset_stamper</span>
|
127
|
-
36: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-node">"#{self.to_s.downcase}_#{self.object_id}_stamper"</span>] = <span class="ruby-keyword kw">nil</span>
|
128
|
-
37: <span class="ruby-keyword kw">end</span>
|
129
|
-
</pre>
|
130
|
-
</div>
|
131
|
-
</div>
|
132
|
-
</div>
|
133
|
-
|
134
|
-
<div id="method-M000003" class="method-detail">
|
135
|
-
<a name="M000003"></a>
|
136
|
-
|
137
|
-
<div class="method-heading">
|
138
|
-
<a href="#M000003" class="method-signature">
|
139
|
-
<span class="method-name">stamper</span><span class="method-args">()</span>
|
140
|
-
</a>
|
141
|
-
</div>
|
142
|
-
|
143
|
-
<div class="method-description">
|
144
|
-
<p>
|
145
|
-
Retrieves the existing <a href="InstanceMethods.html#M000003">stamper</a>
|
146
|
-
for the current request.
|
147
|
-
</p>
|
148
|
-
<p><a class="source-toggle" href="#"
|
149
|
-
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
150
|
-
<div class="method-source-code" id="M000003-source">
|
151
|
-
<pre>
|
152
|
-
<span class="ruby-comment cmt"># File lib/stamper.rb, line 30</span>
|
153
|
-
30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stamper</span>
|
154
|
-
31: <span class="ruby-identifier">find</span>(<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-node">"#{self.to_s.downcase}_#{self.object_id}_stamper"</span>])
|
155
|
-
32: <span class="ruby-keyword kw">end</span>
|
156
|
-
</pre>
|
157
|
-
</div>
|
158
|
-
</div>
|
159
|
-
</div>
|
160
|
-
|
161
|
-
<div id="method-M000002" class="method-detail">
|
162
|
-
<a name="M000002"></a>
|
163
|
-
|
164
|
-
<div class="method-heading">
|
165
|
-
<a href="#M000002" class="method-signature">
|
166
|
-
<span class="method-name">stamper=</span><span class="method-args">(object)</span>
|
167
|
-
</a>
|
168
|
-
</div>
|
169
|
-
|
170
|
-
<div class="method-description">
|
171
|
-
<p>
|
172
|
-
Used to set the <a href="InstanceMethods.html#M000003">stamper</a> for a
|
173
|
-
particular request. See the <a href="../../Userstamp.html">Userstamp</a>
|
174
|
-
module for more details on how to use this method.
|
175
|
-
</p>
|
176
|
-
<p><a class="source-toggle" href="#"
|
177
|
-
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
178
|
-
<div class="method-source-code" id="M000002-source">
|
179
|
-
<pre>
|
180
|
-
<span class="ruby-comment cmt"># File lib/stamper.rb, line 19</span>
|
181
|
-
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stamper=</span>(<span class="ruby-identifier">object</span>)
|
182
|
-
20: <span class="ruby-identifier">object_stamper</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>)
|
183
|
-
21: <span class="ruby-identifier">object</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">"#{object.class.primary_key}"</span>.<span class="ruby-identifier">to_sym</span>)
|
184
|
-
22: <span class="ruby-keyword kw">else</span>
|
185
|
-
23: <span class="ruby-identifier">object</span>
|
186
|
-
24: <span class="ruby-keyword kw">end</span>
|
187
|
-
25:
|
188
|
-
26: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-node">"#{self.to_s.downcase}_#{self.object_id}_stamper"</span>] = <span class="ruby-identifier">object_stamper</span>
|
189
|
-
27: <span class="ruby-keyword kw">end</span>
|
190
|
-
</pre>
|
191
|
-
</div>
|
192
|
-
</div>
|
193
|
-
</div>
|
194
|
-
|
195
|
-
|
196
|
-
</div>
|
197
|
-
|
198
|
-
|
199
|
-
</div>
|
200
|
-
|
201
|
-
|
202
|
-
<div id="validator-badges">
|
203
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
204
|
-
</div>
|
205
|
-
|
206
|
-
</body>
|
207
|
-
</html>
|
data/rdoc/files/CHANGELOG.html
DELETED
@@ -1,137 +0,0 @@
|
|
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>File: CHANGELOG</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="fileHeader">
|
50
|
-
<h1>CHANGELOG</h1>
|
51
|
-
<table class="header-table">
|
52
|
-
<tr class="top-aligned-row">
|
53
|
-
<td><strong>Path:</strong></td>
|
54
|
-
<td>CHANGELOG
|
55
|
-
</td>
|
56
|
-
</tr>
|
57
|
-
<tr class="top-aligned-row">
|
58
|
-
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Sat Apr 05 11:41:29 -0600 2008</td>
|
60
|
-
</tr>
|
61
|
-
</table>
|
62
|
-
</div>
|
63
|
-
<!-- banner header -->
|
64
|
-
|
65
|
-
<div id="bodyContent">
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
<div id="contextContent">
|
70
|
-
|
71
|
-
<div id="description">
|
72
|
-
<p>
|
73
|
-
2.0 (2-17-2008)
|
74
|
-
</p>
|
75
|
-
<pre>
|
76
|
-
* [Ben Wyrosdick] - Added a migration helper that gives migration scripts a <tt>userstamps</tt>
|
77
|
-
method.
|
78
|
-
* [Marshall Roch] - Stamping can be temporarily turned off using the 'without_stamps' class
|
79
|
-
method.
|
80
|
-
Example:
|
81
|
-
Post.without_stamps do
|
82
|
-
post = Post.find(params[:id])
|
83
|
-
post.update_attributes(params[:post])
|
84
|
-
post.save
|
85
|
-
end
|
86
|
-
|
87
|
-
* Models that should receive updates made by 'stampers' now use the acts_as_stampable class
|
88
|
-
method. This sets up the belongs_to relationships and also injects private methods for use by
|
89
|
-
the individual callback filter methods.
|
90
|
-
|
91
|
-
* Models that are responsible for updating now use the acts_as_stamper class method. This
|
92
|
-
injects the stamper= and stamper methods that are thread safe and should be updated per
|
93
|
-
request by a controller.
|
94
|
-
|
95
|
-
* The Userstamp module is now meant to be included with one of your project's controllers (the
|
96
|
-
Application Controller is recommended). It creates a before filter called 'set_stampers' that
|
97
|
-
is responsible for setting all the current Stampers.
|
98
|
-
</pre>
|
99
|
-
<p>
|
100
|
-
1.0 (01-18-2006)
|
101
|
-
</p>
|
102
|
-
<pre>
|
103
|
-
* Initial Release
|
104
|
-
</pre>
|
105
|
-
|
106
|
-
</div>
|
107
|
-
|
108
|
-
|
109
|
-
</div>
|
110
|
-
|
111
|
-
|
112
|
-
</div>
|
113
|
-
|
114
|
-
|
115
|
-
<!-- if includes -->
|
116
|
-
|
117
|
-
<div id="section">
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
<!-- if method_list -->
|
127
|
-
|
128
|
-
|
129
|
-
</div>
|
130
|
-
|
131
|
-
|
132
|
-
<div id="validator-badges">
|
133
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
134
|
-
</div>
|
135
|
-
|
136
|
-
</body>
|
137
|
-
</html>
|