class ActiveModel::Serializer
def serializer_for(resource, options = {})
def serializer_for(resource, options = {}) if resource.respond_to?(:serializer_class) resource.serializer_class elsif resource.respond_to?(:to_ary) if Object.constants.include?(:ArraySerializer) ::ArraySerializer else ArraySerializer end else _const_get build_serializer_class(resource, options) end end