mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user