Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

nickescallon
Copy link
Contributor

@nickescallon nickescallon commented Aug 1, 2016

hasOne links were being created in cases they should not.

  • when no link existed, foreignKey was undefined
  • we tried to filter on relatedCollection where the foreignKey === undefined
  • this returned the entire set of records that did not actually have any related records, where in fact we don't want to find any relations in this case.

@@ -193,6 +193,9 @@ utils.addHiddenPropsToTarget(Relation.prototype, {

// e.g. user hasMany post via "foreignKey", so find all posts of user
findExistingLinksByForeignKey (id) {
if (id === undefined || id === null) {
return
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or we could rework this method such that it returns an empty array in this case.

@Pargus
Copy link

Pargus commented Aug 2, 2016

Issue with Plunkers showing the bug: #380

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

Successfully merging this pull request may close these issues.

3 participants