Don't pass serializer option to associated serializers

Fixes #870

Commit af81a40 introduced passing a serializer's 'options'
along to its associated model serializers.

Thus, an explicit 'each_serializer' passed to render for a
singular resource would be passed on as the implicit 'serializer'
for its associations.

With @bf4
This commit is contained in:
Edward Loveall
2015-06-10 18:20:34 -04:00
parent 7b0a85fdda
commit 0f0ef2baf5
2 changed files with 34 additions and 1 deletions

View File

@@ -217,7 +217,7 @@ module ActiveModel
if serializer_class
serializer = serializer_class.new(
association_value,
options.merge(serializer_from_options(association_options))
options.except(:serializer).merge(serializer_from_options(association_options))
)
elsif !association_value.nil? && !association_value.instance_of?(Object)
association_options[:association_options][:virtual_value] = association_value