update_request 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15adfa1294bbcb4dc4777e3493f53b5d9dc4b2d0
4
- data.tar.gz: 598d629453544927bf8c366830047b03131437a8
3
+ metadata.gz: 21b0c2ca1cafaf9cfe2e98bfe124ba7becee7883
4
+ data.tar.gz: 6a3e1b2f64e75f504c9736313406e9b80c19b709
5
5
  SHA512:
6
- metadata.gz: f448378f2dda3c3be2bc4d43c0be4fbe9331470d357ddf3bfe206d06f7335187be66b4cf9961a94079e5f5318fe7042079afb20d6512e6efed0093702e90f817
7
- data.tar.gz: cd924389208ea8f6e4a0bb3282901243f777d80ba193dc52920ec96b548436299e38b369381b4270f038215cbabf16921f0fccc5b25e2e6eaa18f4f920195e95
6
+ metadata.gz: f2a4f6f33ed114a42daa6bfc1d518ed2d8f26f5ba0633fe6613062e59395f142b6fa514306aa679e2a58d84751b5cb78af987d797bfb738c0a39cdc0c7049033
7
+ data.tar.gz: d048b33f264a893c6c280e849a501a3a9672dcb9cf759e0618db9fa05667bbedb5c5fa487bae4508153300bd164a0caf2e855835f03330495424dcfb2f67ff0d
@@ -137,18 +137,25 @@ class UpdateRequest::Request < ActiveRecord::Base
137
137
  if reference_chain.length > 0
138
138
  sub_schema = schema[next_step]
139
139
 
140
- if sub_schema
141
- sub_schema_with_payload =
142
- insert_at_reference_chain_end(sub_schema, reference_chain, payload)
140
+ # Try using the stringified key if the integer fails (useful in the case
141
+ # of nested attributes arrays that use stringified integers as keys)
143
142
 
144
- schema.dup.tap{|schema_clone| schema_clone[next_step] = sub_schema_with_payload }
145
- else
143
+ unless sub_schema
144
+ next_step = next_step.to_s
145
+ sub_schema = schema[next_step]
146
+ end
147
+
148
+ unless sub_schema
146
149
  raise ArgumentError.new(
147
- "File reference '#{reference_chain}' points to attribute not present in update schema '#{schema}'"
150
+ "File reference '#{next_step}' points to attribute not present in update schema '#{schema}'"
148
151
  )
149
152
 
150
153
  end
151
154
 
155
+ sub_schema_with_payload =
156
+ insert_at_reference_chain_end(sub_schema, reference_chain, payload)
157
+
158
+ schema.dup.tap{|schema_clone| schema_clone[next_step] = sub_schema_with_payload }
152
159
  else
153
160
  schema.dup.tap{|schema_clone| schema_clone[next_step] = payload }
154
161
  end
@@ -1,3 +1,3 @@
1
1
  module UpdateRequest
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: update_request
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleck Greenham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-27 00:00:00.000000000 Z
11
+ date: 2016-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails