I have an example application I'm working on to help me learn about Core Data. In this application I created a model consisting of the entities "Friend" and "City". The application list my friends and which city they are from in an NSTableView. In this table view I would like to have the City column be an NSComboBoxCell with a list of the cities. I got this far... now for the problem:
When I select the city from the combo box, the application takes the value of the selected city name and applies it to the name of the city the friend is currently from. Instead, I would like the application to actually change the city the user is from and not the name of the city... That's a bit confusing of a question, so here's an example: starting with a list of friends like
Andy Asheville Francois Montreal Jeff Asheville
If I use the NSComboBoxCell to change the city for Andy from Asheville to Montreal, the application actually changes the name of the City Asheville to Montreal, so the result looks like:
Andy Montreal Francois Montreal Jeff Montreal
There are still two distinct cities in the application, but they now both have the name Montreal.
This all makes sense to me given the way I set up my bindings. I bound the value of the city table column by setting Model Key Path to "city.name" and the Controller Key to arrangedObjects, which contains the list of friends. So of course, when the value of a cell changes it modifies city.name. So then my question becomes what's the proper way to do this so that the city changes instead of the city name?