[MacRuby-devel] Core Data brain-o
Morgan Schweers
cyberfox at gmail.com
Sat Mar 19 16:54:07 PDT 2011
Greetings,
I was trying to set up automatic migration, and did this brain-o, which will
be obvious to most folks, but stumped me for a little bit:
psc_options = {
NSMigratePersistentStoresAutomaticallyOption:NSNumber.numberWithBool(true),
NSInferMappingModelAutomaticallyOption:NSNumber.numberWithBool(true) }
fail(error)
unless at persistentStoreCoordinator.addPersistentStoreWithType(NSSQLiteStoreType,
configuration:nil, URL:url,
options:psc_options, error:error)
When what I should have been doing was something like:
psc_options = {}
psc_options[NSMigratePersistentStoresAutomaticallyOption] =
NSNumber.numberWithBool(true)
psc_options[NSInferMappingModelAutomaticallyOption] =
NSNumber.numberWithBool(true)
...
...or even...
psc_options = { NSMigratePersistentStoresAutomaticallyOption =>
NSNumber.numberWithBool(true),
NSInferMappingModelAutomaticallyOption =>
NSNumber.numberWithBool(true) }
It's subtle bugs like these that make me slap my head...
...but now Core Data automatic migration works! W00t!
-- Morgan
p.s. If you're trying to do Core Data migration, I found this article
particularly useful:
http://www.timisted.net/blog/archive/core-data-migration/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20110319/6302cff5/attachment.html>
More information about the MacRuby-devel
mailing list