The Array serializer should not make a child root for every item in the Array

This commit is contained in:
Yehuda Katz
2011-12-29 18:13:25 -08:00
parent 1e0c9ef93b
commit e23553be23
2 changed files with 16 additions and 1 deletions

View File

@@ -26,7 +26,8 @@ module ActiveModel
def as_json(*args)
@hash = {}
array = serializable_array.as_json(*args)
array = serializable_array.map(&:serializable_hash)
if root = @options[:root]
@hash.merge!(root => array)