我正在构建一个 Rails API 并使用 Netflix 的fast_jsonapi
代码来序列化我的ActiveRecord
对象:
class PerformancesController < ApplicationController
def index
render json: serialize(user.performances)
end
def serialize(data)
PerformanceSerializer.new(data).serialized_json
end
end
但是,当响应返回时,我必须使用以下命令访问数据response.data.data
:
这对我来说似乎很尴尬。无论如何要删除其中一个数据吗?