Thanks for the help guys. I have this working now, along with the double items. 
Is there any way to avoid/workaround this problem. Or rather another way to get 
a reference to the departments?
Cheers
Rob


On 10/07/2010, at 2:26 AM, Sean McBride wrote:

> On Fri, 9 Jul 2010 05:12:10 -0700, Jerry Krinock said:
> 
>>>> Using the standard Employee/Department example, Whats the best way to
>> set a default department for an Employee?
>>>> So that every employee is created with a relationship to the
>> "mailRoom" department.
>>> 
>>> Probably to add some custom code to AwakeFromInsert in your employee
>> NSManagedObjectSubclass to set its own department.
>> 
>> Yes, that works.
> 
> Agreed, but it can be tricky.  How, from Employee's awakeFromInsert, do
> you get the default Department?  One way would be to fetch.  I do this
> and it's generally fine, except for a bug in NSArrayController:
> 
> 6723165 fetching in awakeFromInsert causes 2 notifications to
> NSArrayController
> 
> Looks like this is actually mentioned in awakeFromInsert's docs now.  Nice!
> 
> So if you have a tableview (bound to an array controller) of Employees,
> adding a new Employee will result in two items in the table (but not
> your model).
> 
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 s...@rogue-research.com
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/gumboots%40mac.com
> 
> This email sent to gumbo...@mac.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to