HasOne nil object should return [] under embedded key.

Ensure that @wrap_in_array is always respected when set to true even
when associated object is nil.
This commit is contained in:
Ken Ip
2014-03-08 14:03:08 -05:00
committed by Adrian Mugnolo
parent b6520315d8
commit 8ca4d4fcd6
3 changed files with 21 additions and 3 deletions

View File

@@ -183,7 +183,7 @@ end
end
def serializable_object(options={})
return nil if object.nil?
return @wrap_in_array ? [] : nil if @object.nil?
hash = attributes
hash.merge! associations
@wrap_in_array ? [hash] : hash