fast_jsonapi
fast_jsonapi copied to clipboard
Params & Sparse Fieldsets
I am trying to achieve something similar to what is described in the JSON API documentation: JSON API - Sparse Fieldsets
im doing the request:rooms?include=[user]
in my controller:
RoomSerializer.new(rooms, params).serialized_json
but the response is
"exception": "#<NoMethodError: undefined method `delete_if' for \"[user]\":String\nDid you mean? delete\n delete!>"
I understand that the error refers to the fact that params is passing a String, even though I am sending the header Content-Type:application/json
Any ideas or suggestions to solve this?
If you send the params directly to the serializer without any changes then your request should look more like :
rooms?include[]=user
@LuisHCK as per the given error, it looks more an error on your application code. We can solve this only if you provide more details - the entire code of your serializer and controller action and the stack traces - but first, please make sure to submit a failing test if you think this is a problem with this gem.