ocean-dynamo 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e59574397e111dc399d72b632fcd21fd73e9f114
4
- data.tar.gz: b93297d296545f8a4f1626eaf8d6bd6936aa5be5
3
+ metadata.gz: e8d4edb25ae2675a1552ce85d20b0fec0f1e6fd1
4
+ data.tar.gz: d4f4f22fd2d251a9d59287e191affcfd4987f79b
5
5
  SHA512:
6
- metadata.gz: 61f93300975ddda2911f33da30761e9773d7a4c488148eb690618f1ec1286869e08ad1c50b25e0ca93ba6b14ddc4dc0989959c660b8d11b282eafaea97c00e03
7
- data.tar.gz: b644c1ce1bf53bc1b55d67adcc7905f077502fddf8a6ad3770470a84d6800665c9c4cbdfaf9e73abae3a1cd9c6119e616efd8e9f85edf9cc45e4b2691f2daeab
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[child_class.table_hash_key.to_s],
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)
@@ -1,3 +1,3 @@
1
1
  module OceanDynamo
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-dynamo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson