ocean-dynamo 1.0.0 → 1.0.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.
- checksums.yaml +4 -4
- data/lib/ocean-dynamo/associations/has_many.rb +6 -5
- data/lib/ocean-dynamo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8d4edb25ae2675a1552ce85d20b0fec0f1e6fd1
|
4
|
+
data.tar.gz: d4f4f22fd2d251a9d59287e191affcfd4987f79b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 028e4e688e8c3a2d084e7ba5301365077285bebd50a9a12953ba528834ff21e818af1b4fdafe61b3bcd3e3598c55178fb247fad17cf8e9f70defd022e9919209
|
7
|
+
data.tar.gz: 94402897d61e39908f08d392b713fda28af6be82268a187edd2503828a592a3a27f561bbfe97184e79f649dd56c4c86f59ae83c034a129475a77f93525d23ecd
|
@@ -162,9 +162,10 @@ module OceanDynamo
|
|
162
162
|
#
|
163
163
|
def delete_children(child_class)
|
164
164
|
return if new_record?
|
165
|
+
child_hash_key = child_class.table_hash_key.to_s
|
166
|
+
child_range_key = child_class.table_range_key && child_class.table_range_key.to_s
|
165
167
|
child_class.in_batches :query, condition_options(child_class) do |attrs|
|
166
|
-
child_class.delete attrs[
|
167
|
-
attrs[child_class.table_range_key.to_s]
|
168
|
+
child_class.delete attrs[child_hash_key], child_range_key && attrs[child_range_key]
|
168
169
|
end
|
169
170
|
end
|
170
171
|
|
@@ -177,11 +178,11 @@ module OceanDynamo
|
|
177
178
|
def nullify_children(child_class)
|
178
179
|
return if new_record?
|
179
180
|
opts = condition_options(child_class)
|
181
|
+
child_hash_key = child_class.table_hash_key.to_s
|
182
|
+
child_range_key = child_class.table_range_key && child_class.table_range_key.to_s
|
180
183
|
child_class.in_batches :query, opts do |attrs|
|
181
|
-
child_hash_key = child_class.table_hash_key.to_s
|
182
|
-
child_range_key = child_class.table_range_key && child_class.table_range_key.to_s
|
183
184
|
# There is no way in the DynamoDB API to update a key attribute. Delete the child item.
|
184
|
-
child_class.delete attrs[child_hash_key], attrs[child_range_key]
|
185
|
+
child_class.delete attrs[child_hash_key], child_range_key && attrs[child_range_key]
|
185
186
|
# Create a new one with NULL for key
|
186
187
|
attrs[child_hash_key] = "NULL"
|
187
188
|
child_class.dynamo_table.put_item(item: attrs)
|
data/lib/ocean-dynamo/version.rb
CHANGED