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

20 lines
457 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module Api
module V1
class ConnectionSerializer < ActiveModel::Serializer
type :connections
attributes :id, :input_id, :output_id
2018-09-13 15:25:16 +08:00
has_one :input_task, serializer: MyModuleSerializer
has_one :output_task, serializer: MyModuleSerializer
def input_task
MyModule.find(object.input_id)
end
def output_task
MyModule.find(object.output_id)
end
end
end
end