You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
374 B

  1. # frozen_string_literal: true
  2. class REST::Admin::CohortSerializer < ActiveModel::Serializer
  3. attributes :period, :frequency
  4. class CohortDataSerializer < ActiveModel::Serializer
  5. attributes :date, :rate, :value
  6. def date
  7. object.date.iso8601
  8. end
  9. end
  10. has_many :data, serializer: CohortDataSerializer
  11. def period
  12. object.period.iso8601
  13. end
  14. end