scinote-web/app/serializers/api/v1/task_group_serializer.rb

15 lines
390 B
Ruby
Raw Normal View History

2018-10-07 01:53:31 +08:00
# frozen_string_literal: true
module Api
module V1
class TaskGroupSerializer < ActiveModel::Serializer
type :task_groups
attributes :id
has_many :my_modules, key: :tasks,
serializer: TaskSerializer,
class_name: 'MyModule',
unless: -> { object.my_modules.empty? }
end
end
end