Open hidde-jan opened 7 years ago
In 0.8.3, I could 'create' a PORO object, and let the id of the object be nil, and everything would render well, i.e.:
class Poro def id nil end def save # some logic end end class PoroResource < JSONAPI::Resource; end
# POST /poros { "data": { "attributes": {}, "type": "poros" } } # Response { "data": { "attributes": {}, "type": "poros", "id": null, "..etc..": "..etc.." } }
However, in 0.9.0, the data is just null:
null
# POST /poros { "data": { "attributes": {}, "type": "poros" } } # Response { "data": null }
This is due to https://github.com/cerebris/jsonapi-resources/blob/release-0-9/lib/jsonapi/resource_serializer.rb#L69
Maybe a short line in the docs somewhere would let people know this happens.
I don't know when this changed, but you can't do idis nil now because then content[:data] is nil here.
id
content[:data]
https://github.com/cerebris/jsonapi-resources/blob/release-0-9/lib/jsonapi/acts_as_resource_controller.rb#L237
In 0.8.3, I could 'create' a PORO object, and let the id of the object be nil, and everything would render well, i.e.:
However, in 0.9.0, the data is just
null
:This is due to https://github.com/cerebris/jsonapi-resources/blob/release-0-9/lib/jsonapi/resource_serializer.rb#L69
Maybe a short line in the docs somewhere would let people know this happens.