Note that we dup the entire reflection instance

This commit is contained in:
Benjamin Fleischer
2018-11-01 14:20:20 -05:00
parent c7e847fc72
commit b358271ef5
2 changed files with 5 additions and 2 deletions

View File

@@ -151,6 +151,9 @@ module ActiveModel
# @yield [ActiveModel::Serializer]
# @return [:nil, associated resource or resource collection]
def value(serializer, include_slice)
# NOTE(BF): This method isn't thread-safe because the _reflections class attribute is not thread-safe
# Therefore, when we build associations from reflections, we dup the entire reflection instance.
# Better solutions much appreciated!
@object = serializer.object
@scope = serializer.scope