global
def serialize_object!(object)
def serialize_object!(object) if collection? if (serializer = instantiate_collection_serializer(object)).nil? # BUG: per #2027, JSON API resource relationships are only id and type, and hence either # *require* a serializer or we need to be a little clever about figuring out the id/type. # In either case, returning the raw virtual value will almost always be incorrect. # # Should be reflection_options[:virtual_value] or adapter needs to figure out what to do # with an object that is non-nil and has no defined serializer. cached_result[:virtual_value] = object.try(:as_json) || object else cached_result[:serializer] = serializer end else cached_result[:serializer] = instantiate_serializer(object) end end