diff options
author | Grzegorz Forysinski <grzegorz.forysinski@u2i.com> | 2009-08-09 18:24:49 -0400 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-08-09 23:39:38 +0100 |
commit | e391c7a97cdefa172fcba214fb0a6cd3bd5b0bf4 (patch) | |
tree | 5509a9c48decef6a1c79f7522c8e40d66706ec72 /activeresource/lib | |
parent | 08ec22054f56442b10f67e41c3b7593da6adcabd (diff) | |
download | rails-e391c7a97cdefa172fcba214fb0a6cd3bd5b0bf4.tar.gz rails-e391c7a97cdefa172fcba214fb0a6cd3bd5b0bf4.tar.bz2 rails-e391c7a97cdefa172fcba214fb0a6cd3bd5b0bf4.zip |
Ensure ActiveResource#load works with numeric arrays [Grzegorz Forysinski, Elad Meidar]
[#2305 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activeresource/lib')
-rw-r--r-- | activeresource/lib/active_resource/base.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb index 0311419fd6..41ffb5413b 100644 --- a/activeresource/lib/active_resource/base.rb +++ b/activeresource/lib/active_resource/base.rb @@ -1020,7 +1020,13 @@ module ActiveResource case value when Array resource = find_or_create_resource_for_collection(key) - value.map { |attrs| attrs.is_a?(String) ? attrs.dup : resource.new(attrs) } + value.map do |attrs| + if attrs.is_a?(String) || attrs.is_a?(Numeric) + attrs.duplicable? ? attrs.dup : attrs + else + resource.new(attrs) + end + end when Hash resource = find_or_create_resource_for(key) resource.new(value) |