Fixes a bug in the HasOne association where serializing twice in a row causes

an exception.
This commit is contained in:
Arne Brasseur
2013-11-11 15:20:45 +01:00
parent 99677c0c58
commit 8c3866532a
2 changed files with 25 additions and 1 deletions

View File

@@ -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