mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Fixes a bug in the HasOne association where serializing twice in a row causes
an exception.
This commit is contained in:
@@ -53,7 +53,7 @@ module ActiveModel
|
||||
end
|
||||
|
||||
def build_serializer(object, options = {})
|
||||
if object.respond_to?(:to_ary)
|
||||
if object.respond_to?(:to_ary) && !(@serializer_class && @serializer_class <= ArraySerializer)
|
||||
use_array_serializer!
|
||||
else
|
||||
@serializer_class ||= Serializer.serializer_for(object) || DefaultSerializer
|
||||
|
||||
Reference in New Issue
Block a user