This project is archived and is in readonly mode.
ActiveResource load method dies on Array contains Numeric elements
-
GrzesF
Attached is example json file which cause the problem.
-
CancelProfileIsBroken
- Tag changed from active_resource, load to active_resource, bugmash, load, patch
-
pjammer
+1 patch verified and works well with the tests. -1 for that json file and using it in the console. I create a mini app, loaded the patch up into it and pasted the contents of that json file into the console and it puked trying to read the hash.
>> m = {"id":"123445567890","referenceid":"homepage_main","videoIds":[13451141001,13460674001,13451144001,13460676001]} SyntaxError: compile error (irb):4: odd number list for Hash m = {"id":"123445567890","referenceid":"... ^ (irb):4: syntax error, unexpected ':', expecting '}' m = {"id":"123445567890","referenceid":"... ^ (irb):4: syntax error, unexpected ',', expecting $end m = {"id":"123445567890","referenceid":"homepage_main",... ^ from (irb):4 >>i couldn't test further on the actual merit, but the tests passed using the patch.
-
Elad Meidar
+1 on patch, applies cleanly on 2-3-stable and master, logic makes sense.
-
Kamal Fariz
Just to add, bare numeric elements in an array is legal JSON according to JSONLint.
-
Jatinder Singh
+1 verified.
I came across this defect at work this week, when I was trying to load an ARes from attributes containing a serialized hash column.
-
Pratik
I don't like
attrs.dup rescue attrsIt should probably use Object#duplicable?.
-
Elad Meidar
Attached a fixed patch with #duplicable?, applies to master and 2-3-stable and passes tests
-
Tristan Dunn
+1
Elad's patch applies cleanly to master and 2-3-stable, with passing tests.
-
Repository
- State changed from new to resolved
(from [59c3b0d0deb8ddd83f20c8a66fde188aed74c51c]) Ensure ActiveResource#load works with numeric arrays [Grzegorz Forysinski, Elad Meidar]
[#2305 ActiveResource load method dies on Array contains Numeric elements state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com
http://github.com/rails/rails/commit/59c3b0d0deb8ddd83f20c8a66fde18... -
Repository
(from [e391c7a97cdefa172fcba214fb0a6cd3bd5b0bf4]) Ensure ActiveResource#load works with numeric arrays [Grzegorz Forysinski, Elad Meidar]
[#2305 ActiveResource load method dies on Array contains Numeric elements state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com
http://github.com/rails/rails/commit/e391c7a97cdefa172fcba214fb0a6c... -
Pratik
- Tag changed from active_resource, bugmash, load, patch to active_resource, load, patch
