views:

15

answers:

1

Hi everyone!

I have an iPhone application, which lets the user add and and modify Assignments. Each Assignment entity is has a relationship with another entity: Course. When the user adds a new Assignment, he has to choose a Course. So far, so good.

But the list of available courses is editable, so while the user is adding an Assignment, he can also create and edit the courses. The problem is, when he saves a new Course, the Assignment is also saved, so even if he then presses cancel at the "Add Assignment" view, the Assignment is alredy saved... Since entities with relationships need to be in the same context, I can't create a new context just for the courses.

Is there any way to save the courses separately?

A: 

Instead of throwing away the context when the user hits cancel, just delete the newly created assignment. After deleting the assignment entity, check if there are any changes (meaning the user added courses) and save the context.

Jason Coco
Wow! Thought I had tried something like that, but obviously not. Thanks!
stocksjo