Remove Hash allocation
merge! takes a Hash as an argument. Rather than allocating a Hash, just use two different `=` calls, to achieve the same result.
This commit is contained in:
parent
a623252c59
commit
006322cff7
|
@ -11,7 +11,10 @@ class ActiveModel::Serializer::Reflection
|
||||||
def build_association(parent_serializer, parent_serializer_options, include_slice = {})
|
def build_association(parent_serializer, parent_serializer_options, include_slice = {})
|
||||||
serializer = options[:serializer]
|
serializer = options[:serializer]
|
||||||
|
|
||||||
parent_serializer_options.merge!(named_contexts: serializer._named_contexts, context_extensions: serializer._context_extensions) if serializer.respond_to?(:_named_contexts)
|
if serializer.respond_to?(:_named_contexts)
|
||||||
|
parent_serializer_options[:named_contexts] = serializer._named_contexts
|
||||||
|
parent_serializer_options[:context_extensions] = serializer._context_extensions
|
||||||
|
end
|
||||||
|
|
||||||
association_options = {
|
association_options = {
|
||||||
parent_serializer: parent_serializer,
|
parent_serializer: parent_serializer,
|
||||||
|
|
Loading…
Reference in New Issue