peimelo/controlled_health_api

View on GitHub
app/serializers/exam_serializer.rb

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
class ExamSerializer < ActiveModel::Serializer
  attributes :id, :name, :unit

  def unit
    if object.unit
      UnitSerializer.new(object.unit).attributes
    else
      false
    end
  end
end