[MacRuby-devel] Create new Core Data Instances

Timo Springmann timo at orangeorb.de
Sun Nov 13 13:20:55 PST 2011


Hi List,

I've successfully created a core data entity with some attributes. I'm displaying object in a NSTableView and I was able to add new instances by calling the entities array controller add: action.

The last hour I tried to figure out how to add/create a core data entity in ruby code without using the interface builder. I tried to instantiate a new object like this:

MyEntity.new

but I always get  the following error:

Failed to call designated initializer on NSManagedObject class 'MyEntity'

What's the proper way of doing this?

For rails-devs: I'm looking for something like:
a = MyARObject.new
a.attribute1 = "test"
a.attribute2 = "test2
a.save

Regards,
Timo

-- 
twitter.com/orangeorb



More information about the MacRuby-devel mailing list