Hey Shannon,

I'm not sure I fully understand, but you should be able to just set the
accessor and do the binding via Xcode as shown here:
http://ofps.oreilly.com/titles/9781449380373/_core_data.html
Let me know if that doesn't answer your question.

- Matt

On Mon, Jun 27, 2011 at 3:45 PM, Shannon Love <tech...@me.com> wrote:

> Howdy,
>
> I've Core Data a lot in Objective-c and now I am trying to use it in
> MacRuby. It occurs to me that I might need to create the to-many
> relationship accessors just like you have to do in Objective-C.
>
> To clarify: Suppose I have a data model that models a file structure and
> which looks like this:
>
> Folder{
>   name:string
>   parent<<-->Folder.subFolders
>   subFolders<-->>Folder.parent
>   files<-->>File.folder
> }
> File{
>   name:string
>   folder<<-->Folder.file
> }
>
>
> In Objective-C, I would normally have methods in the `Folder` class that
> would look like:
>
> addSubFoldersObject:
> removeSubFoldersObject:
> addSubFoldersObjects:
> removeSubFoldersObjects:
>
>
> The methods themselves would use look something like:
>
> - (void)addSubFoldersObject:(FetchedPropertyExtractor *)value {
>     NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
>     [self willChangeValueForKey:@"SubFolders"
> withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
>     [[self primitiveValueForKey:@"SubFolders"] addObject:value];
>     [self didChangeValueForKey:@"SubFolders"
> withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
>     [changedObjects release];
> }
>
>
> Do you have to do the same thing in MacRuby or will the normal ruby set
> operations suffice?
>
> Thanks,
> Shannon Love a.k.a TechZen
>
>
>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to