18F/e-manifest

View on GitHub
app/serializers/manifest_search_serializer.rb

Summary

Maintainability
A
0 mins
Test Coverage
class ManifestSearchSerializer < ActiveModel::Serializer
  attributes(
    :took,
    :total,
    :hits
  )

  def took
    object.took
  end

  def total
    object.results.total
  end

  def hits
    ActiveModel::ArraySerializer.new(object.records.to_a, each_serializer: ManifestSerializer)
  end
end