Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Ignore unknown keys in relationships - #86

Closed
amseddi wants to merge 1 commit into
supermarin:masterfrom
amseddi:ignore-unknown-keys-in-relationship
Closed

amseddi wants to merge 1 commit into
supermarin:masterfrom
amseddi:ignore-unknown-keys-in-relationship

Conversation

@amseddi

@amseddi amseddi commented Mar 26, 2014

Copy link
Copy Markdown

Inspired by pull request #67 : prevent crashs when API adds new keys in related objects by filtering the predicates dictionary.

@stephencelis

Copy link
Copy Markdown
Collaborator

Interesting. This is confusing because nested relations uses findOrCreate: with the dictionary as a condition. There's probably a way to DRY this up, though, so we're doing all our filtering in one place.

@amseddi

amseddi commented Mar 27, 2014

Copy link
Copy Markdown
Author

I agree that there is some repetition. Maybe we can extract the method that checks if the attribute exists ?

@stephencelis

Copy link
Copy Markdown
Collaborator

@amseddi See #87. Sorry for taking this on, but the refactor turned out to touch more code than I expected in order to move all of the transformation logic to one place.

The only change in logic from this PR is that I'm not converting every dictionary before it becomes a predicate, just those that are passed to findOrCreate:. This seems the safest route to go as when you explicitly call where: and its ilk, you're in a client app context and are likely going to want invalid predicates to throw in CoreData, as you'd expect.

Let me know what you think! And thanks for the PR and letting us know about this bug.

@amseddi

amseddi commented Mar 27, 2014

Copy link
Copy Markdown
Author

@stephencelis I am ok with this change as if someone calls where: directly with an invalid dictionary an exception should be raised.
Therefore I am closing this PR and looking forward to PR #87 merging :)

@amseddi amseddi closed this Mar 27, 2014
@amseddi
amseddi deleted the ignore-unknown-keys-in-relationship branch March 27, 2014 16:38
@amseddi
amseddi restored the ignore-unknown-keys-in-relationship branch March 27, 2014 16:38
@amseddi
amseddi deleted the ignore-unknown-keys-in-relationship branch March 27, 2014 16:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants