class ActiveModel::Serializer::Reflection
def value(serializer, include_slice)
-
(:nil, associated resource or resource collection)
-
Other tags:
- Yield: -
Parameters:
-
serializer
(ActiveModel::Serializer
) --
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 block_value = instance_exec(serializer, &block) if block return unless include_data?(include_slice) if block && block_value != :nil block_value else serializer.read_attribute_for_serialization(name) end end