0
我有一個participant
模型,返回一個叫做participable
的多態關係,我需要返回關係類型而不是類型participable
。我在Ember前端使用。如何返回多態關係的類型?
class ParticipantSerializer < ApplicationSerializer # :nodoc:
attributes :id
belongs_to :dispute
belongs_to :participable, polymorphic: true
end
'participant.participable_type' – Bartosz
或'attributes:id,:participable_type' – Bartosz