mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Merge pull request #452 from plexus/has_one_each_serializer_fix
Using a HasOne association twice raises an exception (Undefined method `map')
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