Skip to content

Json_api adapter ignoring post parameters #1858

Open
@exadeci

Description

Expected behavior vs actual behavior

Parameters are sent on post by correctly by json_api_client, AMS with :json_api adapter should make them available in the controller

Instead, params are empty, but if I require the register_jsonapi_renderer they are available just not deserialized.

Steps to reproduce

Doing a create from json_api_client to a AMS that uses the :json_api adapter, the params won't be available.

Environment

ActiveModelSerializers Version (commit ref if not on tag): 0.10.2

Output of ruby -e "puts RUBY_DESCRIPTION": ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]

OS Type & Version: Osx El Capitan 10.11.5

Integrated application and version (e.g., Rails, Grape, etc): rails (5.0.0)

Backtrace

Without any specific configuration (except adapter :json_api):

=> <ActionController::Parameters {"controller"=>"v1/gem_details", "action"=>"create"} permitted: false>

With:

  ActiveSupport.on_load(:action_controller) do
    require 'active_model_serializers/register_jsonapi_renderer'
  end
=> <ActionController::Parameters {"data"=>{"type"=>"gem_details", "attributes"=>{"name"=>"mail", "version"=>"2.5.4", "issues_count"=>1, "project"=>"#<Project:0x007f8da4d73d98>"}}, "controller"=>"v1/gem_details", "action"=>"create"} permitted: false>

Additonal helpful information

The project was created with the -api option, it contains only the serializers, models and controllers, the only config is ActiveModelSerializers.config.adapter = :json_api
The get requests work properly.
Gemfile.lock.txt

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions