Closed pronebird closed 6 years ago
Closing due to absence of interest in proceeding with this PR.
@pronebird No body is here working for MR.
@hardikdevios not sure what you mean. I needed to clean up the stale PRs to free up the reviewable board.
I import a payload presented as array of dictionaries.
Category relationship has userInfo set as following:
While debugging I see it finds the related category using the configured
mappedKeyName
andrelatedAttributed
, I also havedistinctAttribute
set on models.Looking at the implementation of
MR_lookupObjectForRelationship
I see that it supports relationship lookup by having a string provided:So in my case
singleRelatedObjectData
is a string fromrelatedCategoryIdentifier
. But thenMR_importValuesForKeysWithObject
is always called and that causes it to crash because it expects enumerable object andNSString
is not.The crash used to happen in
MR_setRelationship:relatedData:
:Where
relationshipData
is an instance ofNSString
.My fix is to simply avoid calling import for relationship established using string identifier. I don't check for
NSDictionary
because technically seed data can be an object that implements the same methods ofNSDictionary
orNSFastEnumeration
. This is probably useful for generated seed data for test purposes or whatsoever.Merry christmas!