Skip to content

Accept nil data when updating polymorphic to_one relationship #657

Merged
lgebhardt merged 1 commit intoJSONAPI-Resources:masterfrom
Zooip:fix_nil_data_on_polymorphic_to_one_relationship
Apr 29, 2016
Merged

Accept nil data when updating polymorphic to_one relationship #657
lgebhardt merged 1 commit intoJSONAPI-Resources:masterfrom
Zooip:fix_nil_data_on_polymorphic_to_one_relationship

Conversation

@Zooip
Copy link
Copy Markdown
Contributor

@Zooip Zooip commented Mar 17, 2016

Related to #656
Ensure that verified_params[:to_one].values[0] is present before calling [:id] and [:type]

This way the following request clear the polymorphic relationship in the same way as a non-polymorphic relationship.

PATCH /articles/1/relationships/author HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "data": null
}

Wasn't able to create a test case using defined test model since there is no to_one retaltionship.

@lgebhardt lgebhardt merged commit 4f37205 into JSONAPI-Resources:master Apr 29, 2016
@lgebhardt
Copy link
Copy Markdown
Contributor

@Zooip Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants