class ActiveModel::Serializer::Associations::HasOne
def serialize_ids
def serialize_ids id_key = "#{@name}_id".to_sym if polymorphic? if associated_object { :type => polymorphic_key, :id => associated_object.read_attribute_for_serialization(embed_key) } else nil end elsif !option(:embed_key) && !source_serializer.respond_to?(@name.to_s) && source_serializer.object.respond_to?(id_key) source_serializer.object.read_attribute_for_serialization(id_key) elsif associated_object associated_object.read_attribute_for_serialization(embed_key) else nil end end