#<FastJsonapi::MandatoryField: id is a mandatory field in the jsonapi spec>
#<FastJsonapi::MandatoryField: id is a mandatory field in the jsonapi spec>
尝试将枚举对象传递给序列化程序时出现以下错误:
#<FastJsonapi::MandatoryField: id is a mandatory field in the jsonapi spec>
@drop_down_values = Organisation.ownerships
其中 @drop_down_values 具有所有权列中的枚举值。
render json: DropDownValueSerializer.new(@drop_down_values).serialized_json
我发现默认情况下 FastJsonAPI expects
对象 id
。因此,当将对象传递给 serializer
时,它期望 id
出现在传递的对象中。
'https://github.com/Netflix/fast_jsonapi/issues/100' 这已被记录为 FastJsonAPI 中的一个问题。
以下正常工作:
render json: DropDownValueSerializer.new(Organisation.first).serialized_json
尝试将枚举对象传递给序列化程序时出现以下错误:
#<FastJsonapi::MandatoryField: id is a mandatory field in the jsonapi spec>
@drop_down_values = Organisation.ownerships
其中 @drop_down_values 具有所有权列中的枚举值。
render json: DropDownValueSerializer.new(@drop_down_values).serialized_json
我发现默认情况下 FastJsonAPI expects
对象 id
。因此,当将对象传递给 serializer
时,它期望 id
出现在传递的对象中。
'https://github.com/Netflix/fast_jsonapi/issues/100' 这已被记录为 FastJsonAPI 中的一个问题。
以下正常工作:
render json: DropDownValueSerializer.new(Organisation.first).serialized_json