Closed cilim closed 7 years ago
Hi @cilim. The second approach is the supported one for rails. I will look into your issue ASAP, but in the meantime, you can use a workaround based on your first approach: just use params.to_unsafe_h
in order to get a hash from the parameters.
Also, as this issue is rails-specific, would you mind moving it to jsonapi-rb/jsonapi-rails?
Hi @beauby. Thanks for the help! I'll also transfer this issue to jsonapi-rails.
I'm trying to use the jsonapi-rails gem to deserialize the incoming params on an HTTP request, but it's not working as expected.
I tried 2 approaches:
Firstly I followed the instructions from the guides and tried using the default
JSONAPI::Deserializable::Resource.call(json_hash)
like this:but since the JSONAPI::Parser::Resource is expecting a hash an error is raised.
The second approach is using the
deserializable_resource
on the controller level:When I try it like this I get
ActionController::ParameterMissing: param is missing or the value is empty: author
when inspecting theauthor_params
. If I inspect theparams
they are looking like this:which means that the desiralization on the params didn't occur.
Any guidance would be helpful. I'm using ruby 2.3.1p112 and Rails 5.0.1