Skip to content

Support creating polymorphic has-many relationships#1217

Closed
saravanak wants to merge 1 commit intoJSONAPI-Resources:release-0-9from
saravanak:fix_creating_polymorphic_has_many_relations
Closed

Support creating polymorphic has-many relationships#1217
saravanak wants to merge 1 commit intoJSONAPI-Resources:release-0-9from
saravanak:fix_creating_polymorphic_has_many_relations

Conversation

@saravanak
Copy link
Copy Markdown

Consider a resource which has a polymorphic has-many relation .

Existing behavior: While creating the payload for the has-many relation should have the base class name as the type field in the relationships post data.

New behavior: Allows creating a resource which has a polymorphic has-many relation even with the subclass type.

Why: Because ember sends in the subclass modelName (the instance's modelName) while creating a resource of the said specifications.

I have raised a PR against the 0-9 branch as this is the stable branch and this version was working fine against our codebase (master had some errors which I did not spend time on investigating any further..)

All Submissions:

New Feature Submissions:

  • I've submitted an issue that describes this feature, and received the go ahead from the maintainers.
  • My submission includes new tests.
  • My submission maintains compliance with JSON:API.

Bug fixes and Changes to Core Features:

  • I've included an explanation of what the changes do and why I'd like you to include them.
  • I've provided test(s) that fails without the change.

Test Plan:

Reviewer Checklist:

  • Maintains compliance with JSON:API
  • Adequate test coverage exists to prevent regressions

@saravanak saravanak changed the title Support fetching polymorphic has-many relationships Support creating polymorphic has-many relationships Jan 28, 2019
@st0012
Copy link
Copy Markdown
Contributor

st0012 commented Mar 15, 2019

@saravanak thanks for the work! Are you going to fix the test failures though?

@lgebhardt
Copy link
Copy Markdown
Contributor

@saravanak Thanks for working on this. Your changes have been pushed to release-0-9

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.

3 participants