Just to clarify the reason behind this, in Ruby 1.9 { foo:bar } translates into { :foo => bar }. Since you want a has using constants as keys, the shorthand notation doesn't work. In other words, your first example translates to: psc_options = { :NSMigratePersistentStoresAutomaticallyOption => NSNumber.numberWithBool(true), :NSInferMappingModelAutomaticallyOption => NSNumber.numberWithBool(true) } On Sat, Mar 19, 2011 at 7:54 PM, Morgan Schweers <cyberfox@gmail.com> wrote:
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@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/
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel