dynamoid 0.7.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +2 -24
- data/README.markdown +89 -73
- data/Rakefile +10 -36
- data/dynamoid.gemspec +56 -191
- data/lib/dynamoid.rb +6 -4
- data/lib/dynamoid/adapter.rb +64 -150
- data/lib/dynamoid/adapter_plugin/aws_sdk_v2.rb +579 -0
- data/lib/dynamoid/components.rb +0 -1
- data/lib/dynamoid/config.rb +2 -5
- data/lib/dynamoid/criteria.rb +1 -1
- data/lib/dynamoid/criteria/chain.rb +27 -140
- data/lib/dynamoid/document.rb +2 -2
- data/lib/dynamoid/errors.rb +30 -9
- data/lib/dynamoid/fields.rb +15 -3
- data/lib/dynamoid/finders.rb +7 -6
- data/lib/dynamoid/identity_map.rb +1 -5
- data/lib/dynamoid/persistence.rb +108 -93
- metadata +56 -229
- data/.document +0 -5
- data/.rspec +0 -1
- data/.travis.yml +0 -7
- data/Gemfile.lock +0 -81
- data/Gemfile_activemodel4 +0 -24
- data/Gemfile_activemodel4.lock +0 -88
- data/VERSION +0 -1
- data/doc/.nojekyll +0 -0
- data/doc/Dynamoid.html +0 -328
- data/doc/Dynamoid/Adapter.html +0 -1872
- data/doc/Dynamoid/Adapter/AwsSdk.html +0 -2101
- data/doc/Dynamoid/Adapter/Local.html +0 -1574
- data/doc/Dynamoid/Associations.html +0 -138
- data/doc/Dynamoid/Associations/Association.html +0 -847
- data/doc/Dynamoid/Associations/BelongsTo.html +0 -161
- data/doc/Dynamoid/Associations/ClassMethods.html +0 -766
- data/doc/Dynamoid/Associations/HasAndBelongsToMany.html +0 -167
- data/doc/Dynamoid/Associations/HasMany.html +0 -167
- data/doc/Dynamoid/Associations/HasOne.html +0 -161
- data/doc/Dynamoid/Associations/ManyAssociation.html +0 -1684
- data/doc/Dynamoid/Associations/SingleAssociation.html +0 -627
- data/doc/Dynamoid/Components.html +0 -242
- data/doc/Dynamoid/Config.html +0 -412
- data/doc/Dynamoid/Config/Options.html +0 -638
- data/doc/Dynamoid/Criteria.html +0 -138
- data/doc/Dynamoid/Criteria/Chain.html +0 -1471
- data/doc/Dynamoid/Criteria/ClassMethods.html +0 -105
- data/doc/Dynamoid/Dirty.html +0 -424
- data/doc/Dynamoid/Dirty/ClassMethods.html +0 -174
- data/doc/Dynamoid/Document.html +0 -1033
- data/doc/Dynamoid/Document/ClassMethods.html +0 -1116
- data/doc/Dynamoid/Errors.html +0 -125
- data/doc/Dynamoid/Errors/ConditionalCheckFailedException.html +0 -141
- data/doc/Dynamoid/Errors/DocumentNotValid.html +0 -221
- data/doc/Dynamoid/Errors/Error.html +0 -137
- data/doc/Dynamoid/Errors/InvalidField.html +0 -141
- data/doc/Dynamoid/Errors/InvalidQuery.html +0 -131
- data/doc/Dynamoid/Errors/MissingRangeKey.html +0 -141
- data/doc/Dynamoid/Fields.html +0 -686
- data/doc/Dynamoid/Fields/ClassMethods.html +0 -438
- data/doc/Dynamoid/Finders.html +0 -135
- data/doc/Dynamoid/Finders/ClassMethods.html +0 -943
- data/doc/Dynamoid/IdentityMap.html +0 -492
- data/doc/Dynamoid/IdentityMap/ClassMethods.html +0 -534
- data/doc/Dynamoid/Indexes.html +0 -321
- data/doc/Dynamoid/Indexes/ClassMethods.html +0 -369
- data/doc/Dynamoid/Indexes/Index.html +0 -1142
- data/doc/Dynamoid/Middleware.html +0 -115
- data/doc/Dynamoid/Middleware/IdentityMap.html +0 -264
- data/doc/Dynamoid/Persistence.html +0 -892
- data/doc/Dynamoid/Persistence/ClassMethods.html +0 -836
- data/doc/Dynamoid/Validations.html +0 -415
- data/doc/_index.html +0 -506
- data/doc/class_list.html +0 -53
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -57
- data/doc/css/style.css +0 -338
- data/doc/file.LICENSE.html +0 -73
- data/doc/file.README.html +0 -416
- data/doc/file_list.html +0 -58
- data/doc/frames.html +0 -28
- data/doc/index.html +0 -416
- data/doc/js/app.js +0 -214
- data/doc/js/full_list.js +0 -178
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -1144
- data/doc/top-level-namespace.html +0 -112
- data/lib/dynamoid/adapter/aws_sdk.rb +0 -287
- data/lib/dynamoid/indexes.rb +0 -69
- data/lib/dynamoid/indexes/index.rb +0 -103
- data/spec/app/models/address.rb +0 -13
- data/spec/app/models/camel_case.rb +0 -34
- data/spec/app/models/car.rb +0 -6
- data/spec/app/models/magazine.rb +0 -11
- data/spec/app/models/message.rb +0 -9
- data/spec/app/models/nuclear_submarine.rb +0 -5
- data/spec/app/models/sponsor.rb +0 -8
- data/spec/app/models/subscription.rb +0 -12
- data/spec/app/models/tweet.rb +0 -12
- data/spec/app/models/user.rb +0 -26
- data/spec/app/models/vehicle.rb +0 -7
- data/spec/dynamoid/adapter/aws_sdk_spec.rb +0 -376
- data/spec/dynamoid/adapter_spec.rb +0 -155
- data/spec/dynamoid/associations/association_spec.rb +0 -194
- data/spec/dynamoid/associations/belongs_to_spec.rb +0 -71
- data/spec/dynamoid/associations/has_and_belongs_to_many_spec.rb +0 -47
- data/spec/dynamoid/associations/has_many_spec.rb +0 -42
- data/spec/dynamoid/associations/has_one_spec.rb +0 -45
- data/spec/dynamoid/associations_spec.rb +0 -16
- data/spec/dynamoid/config_spec.rb +0 -27
- data/spec/dynamoid/criteria/chain_spec.rb +0 -210
- data/spec/dynamoid/criteria_spec.rb +0 -75
- data/spec/dynamoid/dirty_spec.rb +0 -57
- data/spec/dynamoid/document_spec.rb +0 -180
- data/spec/dynamoid/fields_spec.rb +0 -156
- data/spec/dynamoid/finders_spec.rb +0 -147
- data/spec/dynamoid/identity_map_spec.rb +0 -45
- data/spec/dynamoid/indexes/index_spec.rb +0 -104
- data/spec/dynamoid/indexes_spec.rb +0 -25
- data/spec/dynamoid/persistence_spec.rb +0 -301
- data/spec/dynamoid/validations_spec.rb +0 -36
- data/spec/dynamoid_spec.rb +0 -9
- data/spec/spec_helper.rb +0 -55
- data/spec/support/with_partitioning.rb +0 -15
@@ -1,115 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
<title>
|
7
|
-
Module: Dynamoid::Middleware
|
8
|
-
|
9
|
-
— Documentation by YARD 0.8.6.1
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
hasFrames = window.top.frames.main ? true : false;
|
19
|
-
relpath = '../';
|
20
|
-
framesUrl = "../frames.html#!" + escape(window.location.href);
|
21
|
-
</script>
|
22
|
-
|
23
|
-
|
24
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
-
|
26
|
-
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
-
|
28
|
-
|
29
|
-
</head>
|
30
|
-
<body>
|
31
|
-
<div id="header">
|
32
|
-
<div id="menu">
|
33
|
-
|
34
|
-
<a href="../_index.html">Index (M)</a> »
|
35
|
-
<span class='title'><span class='object_link'><a href="../Dynamoid.html" title="Dynamoid (module)">Dynamoid</a></span></span>
|
36
|
-
»
|
37
|
-
<span class="title">Middleware</span>
|
38
|
-
|
39
|
-
|
40
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
<div id="search">
|
44
|
-
|
45
|
-
<a class="full_list_link" id="class_list_link"
|
46
|
-
href="../class_list.html">
|
47
|
-
Class List
|
48
|
-
</a>
|
49
|
-
|
50
|
-
<a class="full_list_link" id="method_list_link"
|
51
|
-
href="../method_list.html">
|
52
|
-
Method List
|
53
|
-
</a>
|
54
|
-
|
55
|
-
<a class="full_list_link" id="file_list_link"
|
56
|
-
href="../file_list.html">
|
57
|
-
File List
|
58
|
-
</a>
|
59
|
-
|
60
|
-
</div>
|
61
|
-
<div class="clear"></div>
|
62
|
-
</div>
|
63
|
-
|
64
|
-
<iframe id="search_frame"></iframe>
|
65
|
-
|
66
|
-
<div id="content"><h1>Module: Dynamoid::Middleware
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
</h1>
|
71
|
-
|
72
|
-
<dl class="box">
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
<dt class="r1 last">Defined in:</dt>
|
82
|
-
<dd class="r1 last">lib/dynamoid/middleware/identity_map.rb</dd>
|
83
|
-
|
84
|
-
</dl>
|
85
|
-
<div class="clear"></div>
|
86
|
-
|
87
|
-
<h2>Defined Under Namespace</h2>
|
88
|
-
<p class="children">
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Middleware/IdentityMap.html" title="Dynamoid::Middleware::IdentityMap (class)">IdentityMap</a></span>
|
94
|
-
|
95
|
-
|
96
|
-
</p>
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
</div>
|
107
|
-
|
108
|
-
<div id="footer">
|
109
|
-
Generated on Thu Jun 27 21:59:13 2013 by
|
110
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
111
|
-
0.8.6.1 (ruby-1.9.3).
|
112
|
-
</div>
|
113
|
-
|
114
|
-
</body>
|
115
|
-
</html>
|
@@ -1,264 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
<title>
|
7
|
-
Class: Dynamoid::Middleware::IdentityMap
|
8
|
-
|
9
|
-
— Documentation by YARD 0.8.6.1
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
hasFrames = window.top.frames.main ? true : false;
|
19
|
-
relpath = '../../';
|
20
|
-
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
21
|
-
</script>
|
22
|
-
|
23
|
-
|
24
|
-
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
25
|
-
|
26
|
-
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
27
|
-
|
28
|
-
|
29
|
-
</head>
|
30
|
-
<body>
|
31
|
-
<div id="header">
|
32
|
-
<div id="menu">
|
33
|
-
|
34
|
-
<a href="../../_index.html">Index (I)</a> »
|
35
|
-
<span class='title'><span class='object_link'><a href="../../Dynamoid.html" title="Dynamoid (module)">Dynamoid</a></span></span> » <span class='title'><span class='object_link'><a href="../Middleware.html" title="Dynamoid::Middleware (module)">Middleware</a></span></span>
|
36
|
-
»
|
37
|
-
<span class="title">IdentityMap</span>
|
38
|
-
|
39
|
-
|
40
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
<div id="search">
|
44
|
-
|
45
|
-
<a class="full_list_link" id="class_list_link"
|
46
|
-
href="../../class_list.html">
|
47
|
-
Class List
|
48
|
-
</a>
|
49
|
-
|
50
|
-
<a class="full_list_link" id="method_list_link"
|
51
|
-
href="../../method_list.html">
|
52
|
-
Method List
|
53
|
-
</a>
|
54
|
-
|
55
|
-
<a class="full_list_link" id="file_list_link"
|
56
|
-
href="../../file_list.html">
|
57
|
-
File List
|
58
|
-
</a>
|
59
|
-
|
60
|
-
</div>
|
61
|
-
<div class="clear"></div>
|
62
|
-
</div>
|
63
|
-
|
64
|
-
<iframe id="search_frame"></iframe>
|
65
|
-
|
66
|
-
<div id="content"><h1>Class: Dynamoid::Middleware::IdentityMap
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
</h1>
|
71
|
-
|
72
|
-
<dl class="box">
|
73
|
-
|
74
|
-
<dt class="r1">Inherits:</dt>
|
75
|
-
<dd class="r1">
|
76
|
-
<span class="inheritName">Object</span>
|
77
|
-
|
78
|
-
<ul class="fullTree">
|
79
|
-
<li>Object</li>
|
80
|
-
|
81
|
-
<li class="next">Dynamoid::Middleware::IdentityMap</li>
|
82
|
-
|
83
|
-
</ul>
|
84
|
-
<a href="#" class="inheritanceTree">show all</a>
|
85
|
-
|
86
|
-
</dd>
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
<dt class="r2 last">Defined in:</dt>
|
97
|
-
<dd class="r2 last">lib/dynamoid/middleware/identity_map.rb</dd>
|
98
|
-
|
99
|
-
</dl>
|
100
|
-
<div class="clear"></div>
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
<h2>
|
111
|
-
Instance Method Summary
|
112
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
113
|
-
</h2>
|
114
|
-
|
115
|
-
<ul class="summary">
|
116
|
-
|
117
|
-
<li class="public ">
|
118
|
-
<span class="summary_signature">
|
119
|
-
|
120
|
-
<a href="#call-instance_method" title="#call (instance method)">- (Object) <strong>call</strong>(env) </a>
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
</span>
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
135
|
-
|
136
|
-
</li>
|
137
|
-
|
138
|
-
|
139
|
-
<li class="public ">
|
140
|
-
<span class="summary_signature">
|
141
|
-
|
142
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">- (IdentityMap) <strong>initialize</strong>(app) </a>
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
</span>
|
147
|
-
|
148
|
-
|
149
|
-
<span class="note title constructor">constructor</span>
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
<span class="summary_desc"><div class='inline'><p>A new instance of IdentityMap.</p>
|
159
|
-
</div></span>
|
160
|
-
|
161
|
-
</li>
|
162
|
-
|
163
|
-
|
164
|
-
</ul>
|
165
|
-
|
166
|
-
|
167
|
-
<div id="constructor_details" class="method_details_list">
|
168
|
-
<h2>Constructor Details</h2>
|
169
|
-
|
170
|
-
<div class="method_details first">
|
171
|
-
<h3 class="signature first" id="initialize-instance_method">
|
172
|
-
|
173
|
-
- (<tt><span class='object_link'><a href="" title="Dynamoid::Middleware::IdentityMap (class)">IdentityMap</a></span></tt>) <strong>initialize</strong>(app)
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
</h3><div class="docstring">
|
180
|
-
<div class="discussion">
|
181
|
-
<p>A new instance of IdentityMap</p>
|
182
|
-
|
183
|
-
|
184
|
-
</div>
|
185
|
-
</div>
|
186
|
-
<div class="tags">
|
187
|
-
|
188
|
-
|
189
|
-
</div><table class="source_code">
|
190
|
-
<tr>
|
191
|
-
<td>
|
192
|
-
<pre class="lines">
|
193
|
-
|
194
|
-
|
195
|
-
4
|
196
|
-
5
|
197
|
-
6</pre>
|
198
|
-
</td>
|
199
|
-
<td>
|
200
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/middleware/identity_map.rb', line 4</span>
|
201
|
-
|
202
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_app'>app</span><span class='rparen'>)</span>
|
203
|
-
<span class='ivar'>@app</span> <span class='op'>=</span> <span class='id identifier rubyid_app'>app</span>
|
204
|
-
<span class='kw'>end</span></pre>
|
205
|
-
</td>
|
206
|
-
</tr>
|
207
|
-
</table>
|
208
|
-
</div>
|
209
|
-
|
210
|
-
</div>
|
211
|
-
|
212
|
-
|
213
|
-
<div id="instance_method_details" class="method_details_list">
|
214
|
-
<h2>Instance Method Details</h2>
|
215
|
-
|
216
|
-
|
217
|
-
<div class="method_details first">
|
218
|
-
<h3 class="signature first" id="call-instance_method">
|
219
|
-
|
220
|
-
- (<tt>Object</tt>) <strong>call</strong>(env)
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
</h3><table class="source_code">
|
227
|
-
<tr>
|
228
|
-
<td>
|
229
|
-
<pre class="lines">
|
230
|
-
|
231
|
-
|
232
|
-
8
|
233
|
-
9
|
234
|
-
10
|
235
|
-
11
|
236
|
-
12
|
237
|
-
13</pre>
|
238
|
-
</td>
|
239
|
-
<td>
|
240
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/middleware/identity_map.rb', line 8</span>
|
241
|
-
|
242
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
243
|
-
<span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>IdentityMap</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
|
244
|
-
<span class='ivar'>@app</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
245
|
-
<span class='kw'>ensure</span>
|
246
|
-
<span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>IdentityMap</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
|
247
|
-
<span class='kw'>end</span></pre>
|
248
|
-
</td>
|
249
|
-
</tr>
|
250
|
-
</table>
|
251
|
-
</div>
|
252
|
-
|
253
|
-
</div>
|
254
|
-
|
255
|
-
</div>
|
256
|
-
|
257
|
-
<div id="footer">
|
258
|
-
Generated on Thu Jun 27 21:59:14 2013 by
|
259
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
260
|
-
0.8.6.1 (ruby-1.9.3).
|
261
|
-
</div>
|
262
|
-
|
263
|
-
</body>
|
264
|
-
</html>
|
@@ -1,892 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
<title>
|
7
|
-
Module: Dynamoid::Persistence
|
8
|
-
|
9
|
-
— Documentation by YARD 0.8.6.1
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
hasFrames = window.top.frames.main ? true : false;
|
19
|
-
relpath = '../';
|
20
|
-
framesUrl = "../frames.html#!" + escape(window.location.href);
|
21
|
-
</script>
|
22
|
-
|
23
|
-
|
24
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
-
|
26
|
-
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
-
|
28
|
-
|
29
|
-
</head>
|
30
|
-
<body>
|
31
|
-
<div id="header">
|
32
|
-
<div id="menu">
|
33
|
-
|
34
|
-
<a href="../_index.html">Index (P)</a> »
|
35
|
-
<span class='title'><span class='object_link'><a href="../Dynamoid.html" title="Dynamoid (module)">Dynamoid</a></span></span>
|
36
|
-
»
|
37
|
-
<span class="title">Persistence</span>
|
38
|
-
|
39
|
-
|
40
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
<div id="search">
|
44
|
-
|
45
|
-
<a class="full_list_link" id="class_list_link"
|
46
|
-
href="../class_list.html">
|
47
|
-
Class List
|
48
|
-
</a>
|
49
|
-
|
50
|
-
<a class="full_list_link" id="method_list_link"
|
51
|
-
href="../method_list.html">
|
52
|
-
Method List
|
53
|
-
</a>
|
54
|
-
|
55
|
-
<a class="full_list_link" id="file_list_link"
|
56
|
-
href="../file_list.html">
|
57
|
-
File List
|
58
|
-
</a>
|
59
|
-
|
60
|
-
</div>
|
61
|
-
<div class="clear"></div>
|
62
|
-
</div>
|
63
|
-
|
64
|
-
<iframe id="search_frame"></iframe>
|
65
|
-
|
66
|
-
<div id="content"><h1>Module: Dynamoid::Persistence
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
</h1>
|
71
|
-
|
72
|
-
<dl class="box">
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
<dt class="r1">Extended by:</dt>
|
77
|
-
<dd class="r1">ActiveSupport::Concern</dd>
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
<dt class="r2">Included in:</dt>
|
85
|
-
<dd class="r2"><span class='object_link'><a href="Components.html" title="Dynamoid::Components (module)">Components</a></span></dd>
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
<dt class="r1 last">Defined in:</dt>
|
90
|
-
<dd class="r1 last">lib/dynamoid/persistence.rb</dd>
|
91
|
-
|
92
|
-
</dl>
|
93
|
-
<div class="clear"></div>
|
94
|
-
|
95
|
-
<h2>Overview</h2><div class="docstring">
|
96
|
-
<div class="discussion">
|
97
|
-
<p>Persistence is responsible for dumping objects to and marshalling objects from the datastore. It tries to reserialize
|
98
|
-
values to be of the same type as when they were passed in, based on the fields in the class.</p>
|
99
|
-
|
100
|
-
|
101
|
-
</div>
|
102
|
-
</div>
|
103
|
-
<div class="tags">
|
104
|
-
|
105
|
-
|
106
|
-
</div><h2>Defined Under Namespace</h2>
|
107
|
-
<p class="children">
|
108
|
-
|
109
|
-
|
110
|
-
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Persistence/ClassMethods.html" title="Dynamoid::Persistence::ClassMethods (module)">ClassMethods</a></span>
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
</p>
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
121
|
-
<ul class="summary">
|
122
|
-
|
123
|
-
<li class="public ">
|
124
|
-
<span class="summary_signature">
|
125
|
-
|
126
|
-
<a href="#new_record-instance_method" title="#new_record (instance method)">- (Object) <strong>new_record</strong> </a>
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
(also: #new_record?)
|
131
|
-
|
132
|
-
</span>
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute new_record.</p>
|
146
|
-
</div></span>
|
147
|
-
|
148
|
-
</li>
|
149
|
-
|
150
|
-
|
151
|
-
</ul>
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
<h2>
|
158
|
-
Instance Method Summary
|
159
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
160
|
-
</h2>
|
161
|
-
|
162
|
-
<ul class="summary">
|
163
|
-
|
164
|
-
<li class="public ">
|
165
|
-
<span class="summary_signature">
|
166
|
-
|
167
|
-
<a href="#delete-instance_method" title="#delete (instance method)">- (Object) <strong>delete</strong> </a>
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
</span>
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
<span class="summary_desc"><div class='inline'><p>Delete this object from the datastore and all indexes.</p>
|
182
|
-
</div></span>
|
183
|
-
|
184
|
-
</li>
|
185
|
-
|
186
|
-
|
187
|
-
<li class="public ">
|
188
|
-
<span class="summary_signature">
|
189
|
-
|
190
|
-
<a href="#destroy-instance_method" title="#destroy (instance method)">- (Object) <strong>destroy</strong> </a>
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
</span>
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
<span class="summary_desc"><div class='inline'><p>Delete this object, but only after running callbacks for it.</p>
|
205
|
-
</div></span>
|
206
|
-
|
207
|
-
</li>
|
208
|
-
|
209
|
-
|
210
|
-
<li class="public ">
|
211
|
-
<span class="summary_signature">
|
212
|
-
|
213
|
-
<a href="#dump-instance_method" title="#dump (instance method)">- (Object) <strong>dump</strong> </a>
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
</span>
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
<span class="summary_desc"><div class='inline'><p>Dump this object's attributes into hash form, fit to be persisted into the datastore.</p>
|
228
|
-
</div></span>
|
229
|
-
|
230
|
-
</li>
|
231
|
-
|
232
|
-
|
233
|
-
<li class="public ">
|
234
|
-
<span class="summary_signature">
|
235
|
-
|
236
|
-
<a href="#persisted%3F-instance_method" title="#persisted? (instance method)">- (Boolean) <strong>persisted?</strong> </a>
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
</span>
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
<span class="summary_desc"><div class='inline'><p>Is this object persisted in the datastore? Required for some ActiveModel integration stuff.</p>
|
251
|
-
</div></span>
|
252
|
-
|
253
|
-
</li>
|
254
|
-
|
255
|
-
|
256
|
-
<li class="public ">
|
257
|
-
<span class="summary_signature">
|
258
|
-
|
259
|
-
<a href="#save-instance_method" title="#save (instance method)">- (Object) <strong>save</strong>(options = {}) </a>
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
</span>
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
<span class="summary_desc"><div class='inline'><p>Run the callbacks and then persist this object in the datastore.</p>
|
274
|
-
</div></span>
|
275
|
-
|
276
|
-
</li>
|
277
|
-
|
278
|
-
|
279
|
-
<li class="public ">
|
280
|
-
<span class="summary_signature">
|
281
|
-
|
282
|
-
<a href="#touch-instance_method" title="#touch (instance method)">- (Object) <strong>touch</strong>(name = nil) </a>
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
</span>
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
<span class="summary_desc"><div class='inline'><p>Set updated_at and any passed in field to current DateTime.</p>
|
297
|
-
</div></span>
|
298
|
-
|
299
|
-
</li>
|
300
|
-
|
301
|
-
|
302
|
-
<li class="public ">
|
303
|
-
<span class="summary_signature">
|
304
|
-
|
305
|
-
<a href="#update-instance_method" title="#update (instance method)">- (Object) <strong>update</strong>(conditions = {}, &block) </a>
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
</span>
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
320
|
-
|
321
|
-
</li>
|
322
|
-
|
323
|
-
|
324
|
-
<li class="public ">
|
325
|
-
<span class="summary_signature">
|
326
|
-
|
327
|
-
<a href="#update%21-instance_method" title="#update! (instance method)">- (Object) <strong>update!</strong>(conditions = {}, &block) </a>
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
</span>
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
<span class="summary_desc"><div class='inline'><p>update!() will increment the lock_version if the table has the column, but will not check it.</p>
|
342
|
-
</div></span>
|
343
|
-
|
344
|
-
</li>
|
345
|
-
|
346
|
-
|
347
|
-
</ul>
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
<div id="instance_attr_details" class="attr_details">
|
353
|
-
<h2>Instance Attribute Details</h2>
|
354
|
-
|
355
|
-
|
356
|
-
<span id="new_record=-instance_method"></span>
|
357
|
-
<div class="method_details first">
|
358
|
-
<h3 class="signature first" id="new_record-instance_method">
|
359
|
-
|
360
|
-
- (<tt>Object</tt>) <strong>new_record</strong>
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
<span class="aliases">Also known as:
|
365
|
-
<span class="names"><span id='new_record?-instance_method'>new_record?</span></span>
|
366
|
-
</span>
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
</h3><div class="docstring">
|
371
|
-
<div class="discussion">
|
372
|
-
<p>Returns the value of attribute new_record</p>
|
373
|
-
|
374
|
-
|
375
|
-
</div>
|
376
|
-
</div>
|
377
|
-
<div class="tags">
|
378
|
-
|
379
|
-
|
380
|
-
</div><table class="source_code">
|
381
|
-
<tr>
|
382
|
-
<td>
|
383
|
-
<pre class="lines">
|
384
|
-
|
385
|
-
|
386
|
-
11
|
387
|
-
12
|
388
|
-
13</pre>
|
389
|
-
</td>
|
390
|
-
<td>
|
391
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 11</span>
|
392
|
-
|
393
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_new_record'>new_record</span>
|
394
|
-
<span class='ivar'>@new_record</span>
|
395
|
-
<span class='kw'>end</span></pre>
|
396
|
-
</td>
|
397
|
-
</tr>
|
398
|
-
</table>
|
399
|
-
</div>
|
400
|
-
|
401
|
-
</div>
|
402
|
-
|
403
|
-
|
404
|
-
<div id="instance_method_details" class="method_details_list">
|
405
|
-
<h2>Instance Method Details</h2>
|
406
|
-
|
407
|
-
|
408
|
-
<div class="method_details first">
|
409
|
-
<h3 class="signature first" id="delete-instance_method">
|
410
|
-
|
411
|
-
- (<tt>Object</tt>) <strong>delete</strong>
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
</h3><div class="docstring">
|
418
|
-
<div class="discussion">
|
419
|
-
<p>Delete this object from the datastore and all indexes.</p>
|
420
|
-
|
421
|
-
|
422
|
-
</div>
|
423
|
-
</div>
|
424
|
-
<div class="tags">
|
425
|
-
|
426
|
-
<p class="tag_title">Since:</p>
|
427
|
-
<ul class="since">
|
428
|
-
|
429
|
-
<li>
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
<div class='inline'><p>0.2.0</p>
|
436
|
-
</div>
|
437
|
-
|
438
|
-
</li>
|
439
|
-
|
440
|
-
</ul>
|
441
|
-
|
442
|
-
</div><table class="source_code">
|
443
|
-
<tr>
|
444
|
-
<td>
|
445
|
-
<pre class="lines">
|
446
|
-
|
447
|
-
|
448
|
-
211
|
449
|
-
212
|
450
|
-
213
|
451
|
-
214
|
452
|
-
215</pre>
|
453
|
-
</td>
|
454
|
-
<td>
|
455
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 211</span>
|
456
|
-
|
457
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
|
458
|
-
<span class='id identifier rubyid_delete_indexes'>delete_indexes</span>
|
459
|
-
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_range_key'>range_key</span> <span class='op'>?</span> <span class='lbrace'>{</span><span class='symbol'>:range_key</span> <span class='op'>=></span> <span class='id identifier rubyid_dump_field'>dump_field</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_read_attribute'>read_attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rbrace'>}</span> <span class='op'>:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
460
|
-
<span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Adapter</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
461
|
-
<span class='kw'>end</span></pre>
|
462
|
-
</td>
|
463
|
-
</tr>
|
464
|
-
</table>
|
465
|
-
</div>
|
466
|
-
|
467
|
-
<div class="method_details ">
|
468
|
-
<h3 class="signature " id="destroy-instance_method">
|
469
|
-
|
470
|
-
- (<tt>Object</tt>) <strong>destroy</strong>
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
</h3><div class="docstring">
|
477
|
-
<div class="discussion">
|
478
|
-
<p>Delete this object, but only after running callbacks for it.</p>
|
479
|
-
|
480
|
-
|
481
|
-
</div>
|
482
|
-
</div>
|
483
|
-
<div class="tags">
|
484
|
-
|
485
|
-
<p class="tag_title">Since:</p>
|
486
|
-
<ul class="since">
|
487
|
-
|
488
|
-
<li>
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
<div class='inline'><p>0.2.0</p>
|
495
|
-
</div>
|
496
|
-
|
497
|
-
</li>
|
498
|
-
|
499
|
-
</ul>
|
500
|
-
|
501
|
-
</div><table class="source_code">
|
502
|
-
<tr>
|
503
|
-
<td>
|
504
|
-
<pre class="lines">
|
505
|
-
|
506
|
-
|
507
|
-
201
|
508
|
-
202
|
509
|
-
203
|
510
|
-
204
|
511
|
-
205
|
512
|
-
206</pre>
|
513
|
-
</td>
|
514
|
-
<td>
|
515
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 201</span>
|
516
|
-
|
517
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_destroy'>destroy</span>
|
518
|
-
<span class='id identifier rubyid_run_callbacks'>run_callbacks</span><span class='lparen'>(</span><span class='symbol'>:destroy</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
519
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span>
|
520
|
-
<span class='kw'>end</span>
|
521
|
-
<span class='kw'>self</span>
|
522
|
-
<span class='kw'>end</span></pre>
|
523
|
-
</td>
|
524
|
-
</tr>
|
525
|
-
</table>
|
526
|
-
</div>
|
527
|
-
|
528
|
-
<div class="method_details ">
|
529
|
-
<h3 class="signature " id="dump-instance_method">
|
530
|
-
|
531
|
-
- (<tt>Object</tt>) <strong>dump</strong>
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
</h3><div class="docstring">
|
538
|
-
<div class="discussion">
|
539
|
-
<p>Dump this object's attributes into hash form, fit to be persisted into the datastore.</p>
|
540
|
-
|
541
|
-
|
542
|
-
</div>
|
543
|
-
</div>
|
544
|
-
<div class="tags">
|
545
|
-
|
546
|
-
<p class="tag_title">Since:</p>
|
547
|
-
<ul class="since">
|
548
|
-
|
549
|
-
<li>
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
<div class='inline'><p>0.2.0</p>
|
556
|
-
</div>
|
557
|
-
|
558
|
-
</li>
|
559
|
-
|
560
|
-
</ul>
|
561
|
-
|
562
|
-
</div><table class="source_code">
|
563
|
-
<tr>
|
564
|
-
<td>
|
565
|
-
<pre class="lines">
|
566
|
-
|
567
|
-
|
568
|
-
220
|
569
|
-
221
|
570
|
-
222
|
571
|
-
223
|
572
|
-
224
|
573
|
-
225
|
574
|
-
226</pre>
|
575
|
-
</td>
|
576
|
-
<td>
|
577
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 220</span>
|
578
|
-
|
579
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_dump'>dump</span>
|
580
|
-
<span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_tap'>tap</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_hash'>hash</span><span class='op'>|</span>
|
581
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_attribute'>attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='op'>|</span>
|
582
|
-
<span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_dump_field'>dump_field</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_read_attribute'>read_attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
583
|
-
<span class='kw'>end</span>
|
584
|
-
<span class='kw'>end</span>
|
585
|
-
<span class='kw'>end</span></pre>
|
586
|
-
</td>
|
587
|
-
</tr>
|
588
|
-
</table>
|
589
|
-
</div>
|
590
|
-
|
591
|
-
<div class="method_details ">
|
592
|
-
<h3 class="signature " id="persisted?-instance_method">
|
593
|
-
|
594
|
-
- (<tt>Boolean</tt>) <strong>persisted?</strong>
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
</h3><div class="docstring">
|
601
|
-
<div class="discussion">
|
602
|
-
<p>Is this object persisted in the datastore? Required for some ActiveModel integration stuff.</p>
|
603
|
-
|
604
|
-
|
605
|
-
</div>
|
606
|
-
</div>
|
607
|
-
<div class="tags">
|
608
|
-
|
609
|
-
<p class="tag_title">Returns:</p>
|
610
|
-
<ul class="return">
|
611
|
-
|
612
|
-
<li>
|
613
|
-
|
614
|
-
|
615
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
</li>
|
620
|
-
|
621
|
-
</ul>
|
622
|
-
<p class="tag_title">Since:</p>
|
623
|
-
<ul class="since">
|
624
|
-
|
625
|
-
<li>
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
<div class='inline'><p>0.2.0</p>
|
632
|
-
</div>
|
633
|
-
|
634
|
-
</li>
|
635
|
-
|
636
|
-
</ul>
|
637
|
-
|
638
|
-
</div><table class="source_code">
|
639
|
-
<tr>
|
640
|
-
<td>
|
641
|
-
<pre class="lines">
|
642
|
-
|
643
|
-
|
644
|
-
149
|
645
|
-
150
|
646
|
-
151</pre>
|
647
|
-
</td>
|
648
|
-
<td>
|
649
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 149</span>
|
650
|
-
|
651
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_persisted?'>persisted?</span>
|
652
|
-
<span class='op'>!</span><span class='id identifier rubyid_new_record?'>new_record?</span>
|
653
|
-
<span class='kw'>end</span></pre>
|
654
|
-
</td>
|
655
|
-
</tr>
|
656
|
-
</table>
|
657
|
-
</div>
|
658
|
-
|
659
|
-
<div class="method_details ">
|
660
|
-
<h3 class="signature " id="save-instance_method">
|
661
|
-
|
662
|
-
- (<tt>Object</tt>) <strong>save</strong>(options = {})
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
</h3><div class="docstring">
|
669
|
-
<div class="discussion">
|
670
|
-
<p>Run the callbacks and then persist this object in the datastore.</p>
|
671
|
-
|
672
|
-
|
673
|
-
</div>
|
674
|
-
</div>
|
675
|
-
<div class="tags">
|
676
|
-
|
677
|
-
<p class="tag_title">Since:</p>
|
678
|
-
<ul class="since">
|
679
|
-
|
680
|
-
<li>
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
<div class='inline'><p>0.2.0</p>
|
687
|
-
</div>
|
688
|
-
|
689
|
-
</li>
|
690
|
-
|
691
|
-
</ul>
|
692
|
-
|
693
|
-
</div><table class="source_code">
|
694
|
-
<tr>
|
695
|
-
<td>
|
696
|
-
<pre class="lines">
|
697
|
-
|
698
|
-
|
699
|
-
156
|
700
|
-
157
|
701
|
-
158
|
702
|
-
159
|
703
|
-
160
|
704
|
-
161
|
705
|
-
162
|
706
|
-
163
|
707
|
-
164
|
708
|
-
165
|
709
|
-
166
|
710
|
-
167
|
711
|
-
168
|
712
|
-
169</pre>
|
713
|
-
</td>
|
714
|
-
<td>
|
715
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 156</span>
|
716
|
-
|
717
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_save'>save</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
718
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_create_table'>create_table</span>
|
719
|
-
|
720
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_new_record?'>new_record?</span>
|
721
|
-
<span class='id identifier rubyid_conditions'>conditions</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='symbol'>:unless_exists</span> <span class='op'>=></span> <span class='lbracket'>[</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
722
|
-
<span class='id identifier rubyid_conditions'>conditions</span><span class='lbracket'>[</span><span class='symbol'>:unless_exists</span><span class='rbracket'>]</span> <span class='op'><<</span> <span class='id identifier rubyid_range_key'>range_key</span> <span class='kw'>if</span><span class='lparen'>(</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rparen'>)</span>
|
723
|
-
|
724
|
-
<span class='id identifier rubyid_run_callbacks'>run_callbacks</span><span class='lparen'>(</span><span class='symbol'>:create</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_persist'>persist</span><span class='lparen'>(</span><span class='id identifier rubyid_conditions'>conditions</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
725
|
-
<span class='kw'>else</span>
|
726
|
-
<span class='id identifier rubyid_persist'>persist</span>
|
727
|
-
<span class='kw'>end</span>
|
728
|
-
|
729
|
-
<span class='kw'>self</span>
|
730
|
-
<span class='kw'>end</span></pre>
|
731
|
-
</td>
|
732
|
-
</tr>
|
733
|
-
</table>
|
734
|
-
</div>
|
735
|
-
|
736
|
-
<div class="method_details ">
|
737
|
-
<h3 class="signature " id="touch-instance_method">
|
738
|
-
|
739
|
-
- (<tt>Object</tt>) <strong>touch</strong>(name = nil)
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
</h3><div class="docstring">
|
746
|
-
<div class="discussion">
|
747
|
-
<p>Set updated_at and any passed in field to current DateTime. Useful for things like last_login_at, etc.</p>
|
748
|
-
|
749
|
-
|
750
|
-
</div>
|
751
|
-
</div>
|
752
|
-
<div class="tags">
|
753
|
-
|
754
|
-
|
755
|
-
</div><table class="source_code">
|
756
|
-
<tr>
|
757
|
-
<td>
|
758
|
-
<pre class="lines">
|
759
|
-
|
760
|
-
|
761
|
-
139
|
762
|
-
140
|
763
|
-
141
|
764
|
-
142
|
765
|
-
143
|
766
|
-
144</pre>
|
767
|
-
</td>
|
768
|
-
<td>
|
769
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 139</span>
|
770
|
-
|
771
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_touch'>touch</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
772
|
-
<span class='id identifier rubyid_now'>now</span> <span class='op'>=</span> <span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
|
773
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_updated_at'>updated_at</span> <span class='op'>=</span> <span class='id identifier rubyid_now'>now</span>
|
774
|
-
<span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_now'>now</span> <span class='kw'>if</span> <span class='id identifier rubyid_name'>name</span>
|
775
|
-
<span class='id identifier rubyid_save'>save</span>
|
776
|
-
<span class='kw'>end</span></pre>
|
777
|
-
</td>
|
778
|
-
</tr>
|
779
|
-
</table>
|
780
|
-
</div>
|
781
|
-
|
782
|
-
<div class="method_details ">
|
783
|
-
<h3 class="signature " id="update-instance_method">
|
784
|
-
|
785
|
-
- (<tt>Object</tt>) <strong>update</strong>(conditions = {}, &block)
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
</h3><table class="source_code">
|
792
|
-
<tr>
|
793
|
-
<td>
|
794
|
-
<pre class="lines">
|
795
|
-
|
796
|
-
|
797
|
-
191
|
798
|
-
192
|
799
|
-
193
|
800
|
-
194
|
801
|
-
195
|
802
|
-
196</pre>
|
803
|
-
</td>
|
804
|
-
<td>
|
805
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 191</span>
|
806
|
-
|
807
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_update'>update</span><span class='lparen'>(</span><span class='id identifier rubyid_conditions'>conditions</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
808
|
-
<span class='id identifier rubyid_update!'>update!</span><span class='lparen'>(</span><span class='id identifier rubyid_conditions'>conditions</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
809
|
-
<span class='kw'>true</span>
|
810
|
-
<span class='kw'>rescue</span> <span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>ConditionalCheckFailedException</span>
|
811
|
-
<span class='kw'>false</span>
|
812
|
-
<span class='kw'>end</span></pre>
|
813
|
-
</td>
|
814
|
-
</tr>
|
815
|
-
</table>
|
816
|
-
</div>
|
817
|
-
|
818
|
-
<div class="method_details ">
|
819
|
-
<h3 class="signature " id="update!-instance_method">
|
820
|
-
|
821
|
-
- (<tt>Object</tt>) <strong>update!</strong>(conditions = {}, &block)
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
</h3><div class="docstring">
|
828
|
-
<div class="discussion">
|
829
|
-
<p>update!() will increment the lock_version if the table has the column, but will not check it. Thus, a concurrent save will
|
830
|
-
never cause an update! to fail, but an update! may cause a concurrent save to fail.</p>
|
831
|
-
|
832
|
-
|
833
|
-
</div>
|
834
|
-
</div>
|
835
|
-
<div class="tags">
|
836
|
-
|
837
|
-
|
838
|
-
</div><table class="source_code">
|
839
|
-
<tr>
|
840
|
-
<td>
|
841
|
-
<pre class="lines">
|
842
|
-
|
843
|
-
|
844
|
-
176
|
845
|
-
177
|
846
|
-
178
|
847
|
-
179
|
848
|
-
180
|
849
|
-
181
|
850
|
-
182
|
851
|
-
183
|
852
|
-
184
|
853
|
-
185
|
854
|
-
186
|
855
|
-
187
|
856
|
-
188
|
857
|
-
189</pre>
|
858
|
-
</td>
|
859
|
-
<td>
|
860
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 176</span>
|
861
|
-
|
862
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_update!'>update!</span><span class='lparen'>(</span><span class='id identifier rubyid_conditions'>conditions</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
863
|
-
<span class='id identifier rubyid_run_callbacks'>run_callbacks</span><span class='lparen'>(</span><span class='symbol'>:update</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
864
|
-
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_range_key'>range_key</span> <span class='op'>?</span> <span class='lbrace'>{</span><span class='symbol'>:range_key</span> <span class='op'>=></span> <span class='id identifier rubyid_dump_field'>dump_field</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_read_attribute'>read_attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rbrace'>}</span> <span class='op'>:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
865
|
-
<span class='id identifier rubyid_new_attrs'>new_attrs</span> <span class='op'>=</span> <span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Adapter</span><span class='period'>.</span><span class='id identifier rubyid_update_item'>update_item</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='symbol'>:conditions</span> <span class='op'>=></span> <span class='id identifier rubyid_conditions'>conditions</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_t'>t</span><span class='op'>|</span>
|
866
|
-
<span class='kw'>if</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='symbol'>:lock_version</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
867
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Optimistic locking cannot be used with Partitioning</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span><span class='lparen'>(</span><span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_partitioning'>partitioning</span><span class='rparen'>)</span>
|
868
|
-
<span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='label'>lock_version:</span> <span class='int'>1</span><span class='rparen'>)</span>
|
869
|
-
<span class='kw'>end</span>
|
870
|
-
|
871
|
-
<span class='kw'>yield</span> <span class='id identifier rubyid_t'>t</span>
|
872
|
-
<span class='kw'>end</span>
|
873
|
-
<span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='id identifier rubyid_new_attrs'>new_attrs</span><span class='rparen'>)</span>
|
874
|
-
<span class='kw'>end</span>
|
875
|
-
<span class='kw'>end</span></pre>
|
876
|
-
</td>
|
877
|
-
</tr>
|
878
|
-
</table>
|
879
|
-
</div>
|
880
|
-
|
881
|
-
</div>
|
882
|
-
|
883
|
-
</div>
|
884
|
-
|
885
|
-
<div id="footer">
|
886
|
-
Generated on Thu Jun 27 21:59:13 2013 by
|
887
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
888
|
-
0.8.6.1 (ruby-1.9.3).
|
889
|
-
</div>
|
890
|
-
|
891
|
-
</body>
|
892
|
-
</html>
|