gearheads
/
mastodon
Archived
2
0
Fork 0
This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
mastodon/app/serializers/rest/admin/cohort_serializer.rb

20 lines
374 B
Ruby

# frozen_string_literal: true
class REST::Admin::CohortSerializer < ActiveModel::Serializer
attributes :period, :frequency
class CohortDataSerializer < ActiveModel::Serializer
attributes :date, :rate, :value
def date
object.date.iso8601
end
end
has_many :data, serializer: CohortDataSerializer
def period
object.period.iso8601
end
end