dynamoid-moda 0.7.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.
Files changed (136) hide show
  1. checksums.yaml +15 -0
  2. data/.document +5 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +7 -0
  5. data/Gemfile +24 -0
  6. data/Gemfile.lock +118 -0
  7. data/Gemfile_activemodel4 +24 -0
  8. data/Gemfile_activemodel4.lock +88 -0
  9. data/LICENSE.txt +20 -0
  10. data/README.markdown +360 -0
  11. data/Rakefile +93 -0
  12. data/VERSION +1 -0
  13. data/doc/.nojekyll +0 -0
  14. data/doc/Dynamoid.html +328 -0
  15. data/doc/Dynamoid/Adapter.html +1872 -0
  16. data/doc/Dynamoid/Adapter/AwsSdk.html +2101 -0
  17. data/doc/Dynamoid/Adapter/Local.html +1574 -0
  18. data/doc/Dynamoid/Associations.html +138 -0
  19. data/doc/Dynamoid/Associations/Association.html +847 -0
  20. data/doc/Dynamoid/Associations/BelongsTo.html +161 -0
  21. data/doc/Dynamoid/Associations/ClassMethods.html +766 -0
  22. data/doc/Dynamoid/Associations/HasAndBelongsToMany.html +167 -0
  23. data/doc/Dynamoid/Associations/HasMany.html +167 -0
  24. data/doc/Dynamoid/Associations/HasOne.html +161 -0
  25. data/doc/Dynamoid/Associations/ManyAssociation.html +1684 -0
  26. data/doc/Dynamoid/Associations/SingleAssociation.html +627 -0
  27. data/doc/Dynamoid/Components.html +242 -0
  28. data/doc/Dynamoid/Config.html +412 -0
  29. data/doc/Dynamoid/Config/Options.html +638 -0
  30. data/doc/Dynamoid/Criteria.html +138 -0
  31. data/doc/Dynamoid/Criteria/Chain.html +1471 -0
  32. data/doc/Dynamoid/Criteria/ClassMethods.html +105 -0
  33. data/doc/Dynamoid/Dirty.html +424 -0
  34. data/doc/Dynamoid/Dirty/ClassMethods.html +174 -0
  35. data/doc/Dynamoid/Document.html +1033 -0
  36. data/doc/Dynamoid/Document/ClassMethods.html +1116 -0
  37. data/doc/Dynamoid/Errors.html +125 -0
  38. data/doc/Dynamoid/Errors/ConditionalCheckFailedException.html +141 -0
  39. data/doc/Dynamoid/Errors/DocumentNotValid.html +221 -0
  40. data/doc/Dynamoid/Errors/Error.html +137 -0
  41. data/doc/Dynamoid/Errors/InvalidField.html +141 -0
  42. data/doc/Dynamoid/Errors/InvalidQuery.html +131 -0
  43. data/doc/Dynamoid/Errors/MissingRangeKey.html +141 -0
  44. data/doc/Dynamoid/Fields.html +686 -0
  45. data/doc/Dynamoid/Fields/ClassMethods.html +438 -0
  46. data/doc/Dynamoid/Finders.html +135 -0
  47. data/doc/Dynamoid/Finders/ClassMethods.html +943 -0
  48. data/doc/Dynamoid/IdentityMap.html +492 -0
  49. data/doc/Dynamoid/IdentityMap/ClassMethods.html +534 -0
  50. data/doc/Dynamoid/Indexes.html +321 -0
  51. data/doc/Dynamoid/Indexes/ClassMethods.html +369 -0
  52. data/doc/Dynamoid/Indexes/Index.html +1142 -0
  53. data/doc/Dynamoid/Middleware.html +115 -0
  54. data/doc/Dynamoid/Middleware/IdentityMap.html +264 -0
  55. data/doc/Dynamoid/Persistence.html +892 -0
  56. data/doc/Dynamoid/Persistence/ClassMethods.html +836 -0
  57. data/doc/Dynamoid/Validations.html +415 -0
  58. data/doc/_index.html +506 -0
  59. data/doc/class_list.html +53 -0
  60. data/doc/css/common.css +1 -0
  61. data/doc/css/full_list.css +57 -0
  62. data/doc/css/style.css +338 -0
  63. data/doc/file.LICENSE.html +73 -0
  64. data/doc/file.README.html +416 -0
  65. data/doc/file_list.html +58 -0
  66. data/doc/frames.html +28 -0
  67. data/doc/index.html +416 -0
  68. data/doc/js/app.js +214 -0
  69. data/doc/js/full_list.js +178 -0
  70. data/doc/js/jquery.js +4 -0
  71. data/doc/method_list.html +1144 -0
  72. data/doc/top-level-namespace.html +112 -0
  73. data/dynamoid-moda.gemspec +210 -0
  74. data/dynamoid.gemspec +208 -0
  75. data/lib/dynamoid.rb +46 -0
  76. data/lib/dynamoid/adapter.rb +267 -0
  77. data/lib/dynamoid/adapter/aws_sdk.rb +309 -0
  78. data/lib/dynamoid/associations.rb +106 -0
  79. data/lib/dynamoid/associations/association.rb +105 -0
  80. data/lib/dynamoid/associations/belongs_to.rb +44 -0
  81. data/lib/dynamoid/associations/has_and_belongs_to_many.rb +40 -0
  82. data/lib/dynamoid/associations/has_many.rb +39 -0
  83. data/lib/dynamoid/associations/has_one.rb +39 -0
  84. data/lib/dynamoid/associations/many_association.rb +191 -0
  85. data/lib/dynamoid/associations/single_association.rb +69 -0
  86. data/lib/dynamoid/components.rb +37 -0
  87. data/lib/dynamoid/config.rb +57 -0
  88. data/lib/dynamoid/config/options.rb +78 -0
  89. data/lib/dynamoid/criteria.rb +29 -0
  90. data/lib/dynamoid/criteria/chain.rb +326 -0
  91. data/lib/dynamoid/dirty.rb +47 -0
  92. data/lib/dynamoid/document.rb +199 -0
  93. data/lib/dynamoid/errors.rb +28 -0
  94. data/lib/dynamoid/fields.rb +138 -0
  95. data/lib/dynamoid/finders.rb +133 -0
  96. data/lib/dynamoid/identity_map.rb +96 -0
  97. data/lib/dynamoid/indexes.rb +69 -0
  98. data/lib/dynamoid/indexes/index.rb +103 -0
  99. data/lib/dynamoid/middleware/identity_map.rb +16 -0
  100. data/lib/dynamoid/persistence.rb +292 -0
  101. data/lib/dynamoid/validations.rb +36 -0
  102. data/spec/app/models/address.rb +13 -0
  103. data/spec/app/models/camel_case.rb +34 -0
  104. data/spec/app/models/car.rb +6 -0
  105. data/spec/app/models/magazine.rb +11 -0
  106. data/spec/app/models/message.rb +9 -0
  107. data/spec/app/models/nuclear_submarine.rb +5 -0
  108. data/spec/app/models/sponsor.rb +8 -0
  109. data/spec/app/models/subscription.rb +12 -0
  110. data/spec/app/models/tweet.rb +12 -0
  111. data/spec/app/models/user.rb +26 -0
  112. data/spec/app/models/vehicle.rb +7 -0
  113. data/spec/dynamoid/adapter/aws_sdk_spec.rb +376 -0
  114. data/spec/dynamoid/adapter_spec.rb +155 -0
  115. data/spec/dynamoid/associations/association_spec.rb +194 -0
  116. data/spec/dynamoid/associations/belongs_to_spec.rb +71 -0
  117. data/spec/dynamoid/associations/has_and_belongs_to_many_spec.rb +47 -0
  118. data/spec/dynamoid/associations/has_many_spec.rb +42 -0
  119. data/spec/dynamoid/associations/has_one_spec.rb +45 -0
  120. data/spec/dynamoid/associations_spec.rb +16 -0
  121. data/spec/dynamoid/config_spec.rb +27 -0
  122. data/spec/dynamoid/criteria/chain_spec.rb +210 -0
  123. data/spec/dynamoid/criteria_spec.rb +75 -0
  124. data/spec/dynamoid/dirty_spec.rb +57 -0
  125. data/spec/dynamoid/document_spec.rb +180 -0
  126. data/spec/dynamoid/fields_spec.rb +156 -0
  127. data/spec/dynamoid/finders_spec.rb +147 -0
  128. data/spec/dynamoid/identity_map_spec.rb +45 -0
  129. data/spec/dynamoid/indexes/index_spec.rb +104 -0
  130. data/spec/dynamoid/indexes_spec.rb +25 -0
  131. data/spec/dynamoid/persistence_spec.rb +301 -0
  132. data/spec/dynamoid/validations_spec.rb +36 -0
  133. data/spec/dynamoid_spec.rb +14 -0
  134. data/spec/spec_helper.rb +55 -0
  135. data/spec/support/with_partitioning.rb +15 -0
  136. metadata +363 -0
@@ -0,0 +1,115 @@
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
+ &mdash; 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> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../Dynamoid.html" title="Dynamoid (module)">Dynamoid</a></span></span>
36
+ &raquo;
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>
@@ -0,0 +1,264 @@
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
+ &mdash; 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> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../../Dynamoid.html" title="Dynamoid (module)">Dynamoid</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Middleware.html" title="Dynamoid::Middleware (module)">Middleware</a></span></span>
36
+ &raquo;
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>
@@ -0,0 +1,892 @@
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
+ &mdash; 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> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../Dynamoid.html" title="Dynamoid (module)">Dynamoid</a></span></span>
36
+ &raquo;
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 = {}, &amp;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 = {}, &amp;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'>=&gt;</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'>=&gt;</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'>&lt;&lt;</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 = {}, &amp;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'>&amp;</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'>&amp;</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 = {}, &amp;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'>&amp;</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'>=&gt;</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'>=&gt;</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'>&quot;</span><span class='tstring_content'>Optimistic locking cannot be used with Partitioning</span><span class='tstring_end'>&quot;</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>