adept_dynamoid 0.5.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Dynamoid.gemspec +193 -0
- data/Gemfile +23 -0
- data/Gemfile.lock +86 -0
- data/LICENSE.txt +20 -0
- data/README.markdown +265 -0
- data/Rakefile +62 -0
- data/VERSION +1 -0
- data/doc/.nojekyll +0 -0
- data/doc/Dynamoid.html +312 -0
- data/doc/Dynamoid/Adapter.html +1385 -0
- data/doc/Dynamoid/Adapter/AwsSdk.html +1585 -0
- data/doc/Dynamoid/Adapter/Local.html +1574 -0
- data/doc/Dynamoid/Associations.html +131 -0
- data/doc/Dynamoid/Associations/Association.html +794 -0
- data/doc/Dynamoid/Associations/BelongsTo.html +158 -0
- data/doc/Dynamoid/Associations/ClassMethods.html +723 -0
- data/doc/Dynamoid/Associations/HasAndBelongsToMany.html +164 -0
- data/doc/Dynamoid/Associations/HasMany.html +164 -0
- data/doc/Dynamoid/Associations/HasOne.html +158 -0
- data/doc/Dynamoid/Associations/ManyAssociation.html +1640 -0
- data/doc/Dynamoid/Associations/SingleAssociation.html +598 -0
- data/doc/Dynamoid/Components.html +204 -0
- data/doc/Dynamoid/Config.html +395 -0
- data/doc/Dynamoid/Config/Options.html +609 -0
- data/doc/Dynamoid/Criteria.html +131 -0
- data/doc/Dynamoid/Criteria/Chain.html +1063 -0
- data/doc/Dynamoid/Criteria/ClassMethods.html +98 -0
- data/doc/Dynamoid/Document.html +666 -0
- data/doc/Dynamoid/Document/ClassMethods.html +937 -0
- data/doc/Dynamoid/Errors.html +118 -0
- data/doc/Dynamoid/Errors/DocumentNotValid.html +210 -0
- data/doc/Dynamoid/Errors/Error.html +130 -0
- data/doc/Dynamoid/Errors/InvalidField.html +133 -0
- data/doc/Dynamoid/Errors/MissingRangeKey.html +133 -0
- data/doc/Dynamoid/Fields.html +669 -0
- data/doc/Dynamoid/Fields/ClassMethods.html +309 -0
- data/doc/Dynamoid/Finders.html +128 -0
- data/doc/Dynamoid/Finders/ClassMethods.html +516 -0
- data/doc/Dynamoid/Indexes.html +308 -0
- data/doc/Dynamoid/Indexes/ClassMethods.html +353 -0
- data/doc/Dynamoid/Indexes/Index.html +1104 -0
- data/doc/Dynamoid/Persistence.html +651 -0
- data/doc/Dynamoid/Persistence/ClassMethods.html +670 -0
- data/doc/Dynamoid/Validations.html +399 -0
- data/doc/_index.html +461 -0
- data/doc/class_list.html +47 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +55 -0
- data/doc/css/style.css +322 -0
- data/doc/file.LICENSE.html +66 -0
- data/doc/file.README.html +312 -0
- data/doc/file_list.html +52 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +312 -0
- data/doc/js/app.js +205 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +16 -0
- data/doc/method_list.html +1238 -0
- data/doc/top-level-namespace.html +105 -0
- data/lib/dynamoid.rb +47 -0
- data/lib/dynamoid/adapter.rb +177 -0
- data/lib/dynamoid/adapter/aws_sdk.rb +223 -0
- data/lib/dynamoid/associations.rb +106 -0
- data/lib/dynamoid/associations/association.rb +105 -0
- data/lib/dynamoid/associations/belongs_to.rb +44 -0
- data/lib/dynamoid/associations/has_and_belongs_to_many.rb +40 -0
- data/lib/dynamoid/associations/has_many.rb +39 -0
- data/lib/dynamoid/associations/has_one.rb +39 -0
- data/lib/dynamoid/associations/many_association.rb +191 -0
- data/lib/dynamoid/associations/single_association.rb +69 -0
- data/lib/dynamoid/components.rb +36 -0
- data/lib/dynamoid/config.rb +57 -0
- data/lib/dynamoid/config/options.rb +78 -0
- data/lib/dynamoid/criteria.rb +29 -0
- data/lib/dynamoid/criteria/chain.rb +243 -0
- data/lib/dynamoid/dirty.rb +41 -0
- data/lib/dynamoid/document.rb +184 -0
- data/lib/dynamoid/errors.rb +28 -0
- data/lib/dynamoid/fields.rb +130 -0
- data/lib/dynamoid/finders.rb +131 -0
- data/lib/dynamoid/identity_map.rb +96 -0
- data/lib/dynamoid/indexes.rb +69 -0
- data/lib/dynamoid/indexes/index.rb +103 -0
- data/lib/dynamoid/middleware/identity_map.rb +16 -0
- data/lib/dynamoid/persistence.rb +247 -0
- data/lib/dynamoid/validations.rb +36 -0
- data/spec/app/models/address.rb +10 -0
- data/spec/app/models/camel_case.rb +24 -0
- data/spec/app/models/magazine.rb +11 -0
- data/spec/app/models/message.rb +9 -0
- data/spec/app/models/sponsor.rb +8 -0
- data/spec/app/models/subscription.rb +12 -0
- data/spec/app/models/tweet.rb +12 -0
- data/spec/app/models/user.rb +26 -0
- data/spec/dynamoid/adapter/aws_sdk_spec.rb +186 -0
- data/spec/dynamoid/adapter_spec.rb +117 -0
- data/spec/dynamoid/associations/association_spec.rb +194 -0
- data/spec/dynamoid/associations/belongs_to_spec.rb +71 -0
- data/spec/dynamoid/associations/has_and_belongs_to_many_spec.rb +47 -0
- data/spec/dynamoid/associations/has_many_spec.rb +42 -0
- data/spec/dynamoid/associations/has_one_spec.rb +45 -0
- data/spec/dynamoid/associations_spec.rb +16 -0
- data/spec/dynamoid/config_spec.rb +27 -0
- data/spec/dynamoid/criteria/chain_spec.rb +140 -0
- data/spec/dynamoid/criteria_spec.rb +72 -0
- data/spec/dynamoid/dirty_spec.rb +49 -0
- data/spec/dynamoid/document_spec.rb +118 -0
- data/spec/dynamoid/fields_spec.rb +127 -0
- data/spec/dynamoid/finders_spec.rb +135 -0
- data/spec/dynamoid/identity_map_spec.rb +45 -0
- data/spec/dynamoid/indexes/index_spec.rb +104 -0
- data/spec/dynamoid/indexes_spec.rb +25 -0
- data/spec/dynamoid/persistence_spec.rb +176 -0
- data/spec/dynamoid/validations_spec.rb +36 -0
- data/spec/dynamoid_spec.rb +9 -0
- data/spec/spec_helper.rb +50 -0
- metadata +376 -0
@@ -0,0 +1,651 @@
|
|
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.7.5
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '..';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="../_index.html">Index (P)</a> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../Dynamoid.html" title="Dynamoid (module)">Dynamoid</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">Persistence</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Module: Dynamoid::Persistence
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<dt class="r1">Extended by:</dt>
|
70
|
+
<dd class="r1">ActiveSupport::Concern</dd>
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
<dt class="r2">Included in:</dt>
|
78
|
+
<dd class="r2"><span class='object_link'><a href="Components.html" title="Dynamoid::Components (module)">Components</a></span></dd>
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
<dt class="r1 last">Defined in:</dt>
|
83
|
+
<dd class="r1 last">lib/dynamoid/persistence.rb</dd>
|
84
|
+
|
85
|
+
</dl>
|
86
|
+
<div class="clear"></div>
|
87
|
+
|
88
|
+
<h2>Overview</h2><div class="docstring">
|
89
|
+
<div class="discussion">
|
90
|
+
<p>Persistence is responsible for dumping objects to and marshalling objects from the datastore. It tries to reserialize
|
91
|
+
values to be of the same type as when they were passed in, based on the fields in the class.</p>
|
92
|
+
|
93
|
+
|
94
|
+
</div>
|
95
|
+
</div>
|
96
|
+
<div class="tags">
|
97
|
+
|
98
|
+
|
99
|
+
</div><h2>Defined Under Namespace</h2>
|
100
|
+
<p class="children">
|
101
|
+
|
102
|
+
|
103
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Persistence/ClassMethods.html" title="Dynamoid::Persistence::ClassMethods (module)">ClassMethods</a></span>
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
</p>
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
114
|
+
<ul class="summary">
|
115
|
+
|
116
|
+
<li class="public ">
|
117
|
+
<span class="summary_signature">
|
118
|
+
|
119
|
+
<a href="#new_record-instance_method" title="#new_record (instance method)">- (Object) <strong>new_record</strong> </a>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
(also: #new_record?)
|
124
|
+
|
125
|
+
</span>
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute new_record.</p>
|
138
|
+
</div></span>
|
139
|
+
|
140
|
+
</li>
|
141
|
+
|
142
|
+
|
143
|
+
</ul>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<h2>
|
150
|
+
Instance Method Summary
|
151
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
152
|
+
</h2>
|
153
|
+
|
154
|
+
<ul class="summary">
|
155
|
+
|
156
|
+
<li class="public ">
|
157
|
+
<span class="summary_signature">
|
158
|
+
|
159
|
+
<a href="#delete-instance_method" title="#delete (instance method)">- (Object) <strong>delete</strong> </a>
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
</span>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<span class="summary_desc"><div class='inline'><p>Delete this object from the datastore and all indexes.</p>
|
173
|
+
</div></span>
|
174
|
+
|
175
|
+
</li>
|
176
|
+
|
177
|
+
|
178
|
+
<li class="public ">
|
179
|
+
<span class="summary_signature">
|
180
|
+
|
181
|
+
<a href="#destroy-instance_method" title="#destroy (instance method)">- (Object) <strong>destroy</strong> </a>
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
</span>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
<span class="summary_desc"><div class='inline'><p>Delete this object, but only after running callbacks for it.</p>
|
195
|
+
</div></span>
|
196
|
+
|
197
|
+
</li>
|
198
|
+
|
199
|
+
|
200
|
+
<li class="public ">
|
201
|
+
<span class="summary_signature">
|
202
|
+
|
203
|
+
<a href="#dump-instance_method" title="#dump (instance method)">- (Object) <strong>dump</strong> </a>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
</span>
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
<span class="summary_desc"><div class='inline'><p>Dump this object's attributes into hash form, fit to be persisted into the datastore.</p>
|
217
|
+
</div></span>
|
218
|
+
|
219
|
+
</li>
|
220
|
+
|
221
|
+
|
222
|
+
<li class="public ">
|
223
|
+
<span class="summary_signature">
|
224
|
+
|
225
|
+
<a href="#persisted%3F-instance_method" title="#persisted? (instance method)">- (Boolean) <strong>persisted?</strong> </a>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
</span>
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
<span class="summary_desc"><div class='inline'><p>Is this object persisted in the datastore? Required for some ActiveModel integration stuff.</p>
|
239
|
+
</div></span>
|
240
|
+
|
241
|
+
</li>
|
242
|
+
|
243
|
+
|
244
|
+
<li class="public ">
|
245
|
+
<span class="summary_signature">
|
246
|
+
|
247
|
+
<a href="#save-instance_method" title="#save (instance method)">- (Object) <strong>save</strong>(options = {}) </a>
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
</span>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
<span class="summary_desc"><div class='inline'><p>Run the callbacks and then persist this object in the datastore.</p>
|
261
|
+
</div></span>
|
262
|
+
|
263
|
+
</li>
|
264
|
+
|
265
|
+
|
266
|
+
</ul>
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
<div id="instance_attr_details" class="attr_details">
|
272
|
+
<h2>Instance Attribute Details</h2>
|
273
|
+
|
274
|
+
|
275
|
+
<span id="new_record=-instance_method"></span>
|
276
|
+
<span id="new_record-instance_method"></span>
|
277
|
+
<div class="method_details first">
|
278
|
+
<p class="signature first" id="new_record-instance_method">
|
279
|
+
|
280
|
+
- (<tt>Object</tt>) <strong>new_record</strong>
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
<span class="aliases">Also known as:
|
285
|
+
<span class="names"><span id='new_record?-instance_method'>new_record?</span></span>
|
286
|
+
</span>
|
287
|
+
|
288
|
+
</p><div class="docstring">
|
289
|
+
<div class="discussion">
|
290
|
+
<p>Returns the value of attribute new_record</p>
|
291
|
+
|
292
|
+
|
293
|
+
</div>
|
294
|
+
</div>
|
295
|
+
<div class="tags">
|
296
|
+
|
297
|
+
|
298
|
+
</div><table class="source_code">
|
299
|
+
<tr>
|
300
|
+
<td>
|
301
|
+
<pre class="lines">
|
302
|
+
|
303
|
+
|
304
|
+
11
|
305
|
+
12
|
306
|
+
13</pre>
|
307
|
+
</td>
|
308
|
+
<td>
|
309
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 11</span>
|
310
|
+
|
311
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_new_record'>new_record</span>
|
312
|
+
<span class='ivar'>@new_record</span>
|
313
|
+
<span class='kw'>end</span></pre>
|
314
|
+
</td>
|
315
|
+
</tr>
|
316
|
+
</table>
|
317
|
+
</div>
|
318
|
+
|
319
|
+
</div>
|
320
|
+
|
321
|
+
|
322
|
+
<div id="instance_method_details" class="method_details_list">
|
323
|
+
<h2>Instance Method Details</h2>
|
324
|
+
|
325
|
+
|
326
|
+
<div class="method_details first">
|
327
|
+
<p class="signature first" id="delete-instance_method">
|
328
|
+
|
329
|
+
- (<tt>Object</tt>) <strong>delete</strong>
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
</p><div class="docstring">
|
334
|
+
<div class="discussion">
|
335
|
+
<p>Delete this object from the datastore and all indexes.</p>
|
336
|
+
|
337
|
+
|
338
|
+
</div>
|
339
|
+
</div>
|
340
|
+
<div class="tags">
|
341
|
+
|
342
|
+
<h3>Since:</h3>
|
343
|
+
<ul class="since">
|
344
|
+
|
345
|
+
<li>
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
<div class='inline'><p>0.2.0</p>
|
352
|
+
</div>
|
353
|
+
|
354
|
+
</li>
|
355
|
+
|
356
|
+
</ul>
|
357
|
+
|
358
|
+
</div><table class="source_code">
|
359
|
+
<tr>
|
360
|
+
<td>
|
361
|
+
<pre class="lines">
|
362
|
+
|
363
|
+
|
364
|
+
141
|
365
|
+
142
|
366
|
+
143
|
367
|
+
144</pre>
|
368
|
+
</td>
|
369
|
+
<td>
|
370
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 141</span>
|
371
|
+
|
372
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
|
373
|
+
<span class='id identifier rubyid_delete_indexes'>delete_indexes</span>
|
374
|
+
<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_id'>id</span><span class='rparen'>)</span>
|
375
|
+
<span class='kw'>end</span></pre>
|
376
|
+
</td>
|
377
|
+
</tr>
|
378
|
+
</table>
|
379
|
+
</div>
|
380
|
+
|
381
|
+
<div class="method_details ">
|
382
|
+
<p class="signature " id="destroy-instance_method">
|
383
|
+
|
384
|
+
- (<tt>Object</tt>) <strong>destroy</strong>
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
</p><div class="docstring">
|
389
|
+
<div class="discussion">
|
390
|
+
<p>Delete this object, but only after running callbacks for it.</p>
|
391
|
+
|
392
|
+
|
393
|
+
</div>
|
394
|
+
</div>
|
395
|
+
<div class="tags">
|
396
|
+
|
397
|
+
<h3>Since:</h3>
|
398
|
+
<ul class="since">
|
399
|
+
|
400
|
+
<li>
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
<div class='inline'><p>0.2.0</p>
|
407
|
+
</div>
|
408
|
+
|
409
|
+
</li>
|
410
|
+
|
411
|
+
</ul>
|
412
|
+
|
413
|
+
</div><table class="source_code">
|
414
|
+
<tr>
|
415
|
+
<td>
|
416
|
+
<pre class="lines">
|
417
|
+
|
418
|
+
|
419
|
+
131
|
420
|
+
132
|
421
|
+
133
|
422
|
+
134
|
423
|
+
135
|
424
|
+
136</pre>
|
425
|
+
</td>
|
426
|
+
<td>
|
427
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 131</span>
|
428
|
+
|
429
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_destroy'>destroy</span>
|
430
|
+
<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>
|
431
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span>
|
432
|
+
<span class='kw'>end</span>
|
433
|
+
<span class='kw'>self</span>
|
434
|
+
<span class='kw'>end</span></pre>
|
435
|
+
</td>
|
436
|
+
</tr>
|
437
|
+
</table>
|
438
|
+
</div>
|
439
|
+
|
440
|
+
<div class="method_details ">
|
441
|
+
<p class="signature " id="dump-instance_method">
|
442
|
+
|
443
|
+
- (<tt>Object</tt>) <strong>dump</strong>
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
</p><div class="docstring">
|
448
|
+
<div class="discussion">
|
449
|
+
<p>Dump this object's attributes into hash form, fit to be persisted into the datastore.</p>
|
450
|
+
|
451
|
+
|
452
|
+
</div>
|
453
|
+
</div>
|
454
|
+
<div class="tags">
|
455
|
+
|
456
|
+
<h3>Since:</h3>
|
457
|
+
<ul class="since">
|
458
|
+
|
459
|
+
<li>
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
<div class='inline'><p>0.2.0</p>
|
466
|
+
</div>
|
467
|
+
|
468
|
+
</li>
|
469
|
+
|
470
|
+
</ul>
|
471
|
+
|
472
|
+
</div><table class="source_code">
|
473
|
+
<tr>
|
474
|
+
<td>
|
475
|
+
<pre class="lines">
|
476
|
+
|
477
|
+
|
478
|
+
149
|
479
|
+
150
|
480
|
+
151
|
481
|
+
152
|
482
|
+
153
|
483
|
+
154
|
484
|
+
155</pre>
|
485
|
+
</td>
|
486
|
+
<td>
|
487
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 149</span>
|
488
|
+
|
489
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_dump'>dump</span>
|
490
|
+
<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>
|
491
|
+
<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>
|
492
|
+
<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='lbracket'>[</span><span class='symbol'>:type</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
493
|
+
<span class='kw'>end</span>
|
494
|
+
<span class='kw'>end</span>
|
495
|
+
<span class='kw'>end</span></pre>
|
496
|
+
</td>
|
497
|
+
</tr>
|
498
|
+
</table>
|
499
|
+
</div>
|
500
|
+
|
501
|
+
<div class="method_details ">
|
502
|
+
<p class="signature " id="persisted?-instance_method">
|
503
|
+
|
504
|
+
- (<tt>Boolean</tt>) <strong>persisted?</strong>
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
</p><div class="docstring">
|
509
|
+
<div class="discussion">
|
510
|
+
<p>Is this object persisted in the datastore? Required for some ActiveModel integration stuff.</p>
|
511
|
+
|
512
|
+
|
513
|
+
</div>
|
514
|
+
</div>
|
515
|
+
<div class="tags">
|
516
|
+
|
517
|
+
<h3>Returns:</h3>
|
518
|
+
<ul class="return">
|
519
|
+
|
520
|
+
<li>
|
521
|
+
|
522
|
+
|
523
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
</li>
|
528
|
+
|
529
|
+
</ul>
|
530
|
+
<h3>Since:</h3>
|
531
|
+
<ul class="since">
|
532
|
+
|
533
|
+
<li>
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
<div class='inline'><p>0.2.0</p>
|
540
|
+
</div>
|
541
|
+
|
542
|
+
</li>
|
543
|
+
|
544
|
+
</ul>
|
545
|
+
|
546
|
+
</div><table class="source_code">
|
547
|
+
<tr>
|
548
|
+
<td>
|
549
|
+
<pre class="lines">
|
550
|
+
|
551
|
+
|
552
|
+
107
|
553
|
+
108
|
554
|
+
109</pre>
|
555
|
+
</td>
|
556
|
+
<td>
|
557
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 107</span>
|
558
|
+
|
559
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_persisted?'>persisted?</span>
|
560
|
+
<span class='op'>!</span><span class='id identifier rubyid_new_record?'>new_record?</span>
|
561
|
+
<span class='kw'>end</span></pre>
|
562
|
+
</td>
|
563
|
+
</tr>
|
564
|
+
</table>
|
565
|
+
</div>
|
566
|
+
|
567
|
+
<div class="method_details ">
|
568
|
+
<p class="signature " id="save-instance_method">
|
569
|
+
|
570
|
+
- (<tt>Object</tt>) <strong>save</strong>(options = {})
|
571
|
+
|
572
|
+
|
573
|
+
|
574
|
+
</p><div class="docstring">
|
575
|
+
<div class="discussion">
|
576
|
+
<p>Run the callbacks and then persist this object in the datastore.</p>
|
577
|
+
|
578
|
+
|
579
|
+
</div>
|
580
|
+
</div>
|
581
|
+
<div class="tags">
|
582
|
+
|
583
|
+
<h3>Since:</h3>
|
584
|
+
<ul class="since">
|
585
|
+
|
586
|
+
<li>
|
587
|
+
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
<div class='inline'><p>0.2.0</p>
|
593
|
+
</div>
|
594
|
+
|
595
|
+
</li>
|
596
|
+
|
597
|
+
</ul>
|
598
|
+
|
599
|
+
</div><table class="source_code">
|
600
|
+
<tr>
|
601
|
+
<td>
|
602
|
+
<pre class="lines">
|
603
|
+
|
604
|
+
|
605
|
+
114
|
606
|
+
115
|
607
|
+
116
|
608
|
+
117
|
609
|
+
118
|
610
|
+
119
|
611
|
+
120
|
612
|
+
121
|
613
|
+
122
|
614
|
+
123
|
615
|
+
124
|
616
|
+
125
|
617
|
+
126</pre>
|
618
|
+
</td>
|
619
|
+
<td>
|
620
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 114</span>
|
621
|
+
|
622
|
+
<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>
|
623
|
+
<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>
|
624
|
+
|
625
|
+
<span class='ivar'>@previously_changed</span> <span class='op'>=</span> <span class='id identifier rubyid_changes'>changes</span>
|
626
|
+
|
627
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_new_record?'>new_record?</span>
|
628
|
+
<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='rbrace'>}</span>
|
629
|
+
<span class='kw'>else</span>
|
630
|
+
<span class='id identifier rubyid_persist'>persist</span>
|
631
|
+
<span class='kw'>end</span>
|
632
|
+
|
633
|
+
<span class='kw'>self</span>
|
634
|
+
<span class='kw'>end</span></pre>
|
635
|
+
</td>
|
636
|
+
</tr>
|
637
|
+
</table>
|
638
|
+
</div>
|
639
|
+
|
640
|
+
</div>
|
641
|
+
|
642
|
+
</div>
|
643
|
+
|
644
|
+
<div id="footer">
|
645
|
+
Generated on Thu Apr 26 01:26:25 2012 by
|
646
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
647
|
+
0.7.5 (ruby-1.9.3).
|
648
|
+
</div>
|
649
|
+
|
650
|
+
</body>
|
651
|
+
</html>
|