Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Avoid duplicated entries when importing data with Magical Record #357
I'm using Magical Record to facilitate Core Data operations. Imagine we have a set of json like this, and a Core Data model defined exactly the same:
However, in our Core Data model, Car-Brand relationship is a many-to-many one, and Brand's name attribute is supposed to be unique, so I'm expecting 5 entries of Car and 2 entries of Brand (Toyota and VW).
My question is how to maintain the data uniqueness while importing with Core Data. Is this something I can define in Core Data model, like unique attribute? or is it I need to override Magical Record's import method?
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
Have to set the primaryRelatedAttribute key as specified in this blog post: http://www.cimgf.com/2012/05/29/importing-data-made-easy/
On Saturday, December 29, 2012 at 2:10 PM, Chris Chen wrote: