class ActiveModel::Serializer

def serializable_hash(adapter_options = nil, options = {}, adapter_instance = self.class.serialization_adapter_instance)

Parameters:
  • options (nil, Hash) -- The same valid options passed to `serializable_hash`

Returns:
  • (Hash) - containing the attributes and first level
def serializable_hash(adapter_options = nil, options = {}, adapter_instance = self.class.serialization_adapter_instance)
  adapter_options ||= {}
  options[:include_directive] ||= ActiveModel::Serializer.include_directive_from_options(adapter_options)
  cached_attributes = adapter_options[:cached_attributes] ||= {}
  resource = fetch_attributes(options[:fields], cached_attributes, adapter_instance)
  relationships = resource_relationships(adapter_options, options, adapter_instance)
  resource.merge(relationships)
end