Hi, Can't figure this one out, not for the want of trying though. Models involved are Category, CandidateItem which are associated in each model as HABTM. I created a temp baked project to see if the association definition was correct and it appears to be.
In my categories_controller I have a method which is called via AJAX from a categories view. The method does stuff that returns an array of strings which I want to create CandidateItems from. I have tried a number of ways to do this. Firstly with a large array thus: $data = array(); $data["Category"]["id"] = $categoryId; // set previously foreach($titles as $title) { $data["CandidateItem"]["CandidateItem"][$count]["title"] = $title; $data["CandidateItem"]["CandidateItem"][$count]["category_id"] = $categoryId; } $this->Category->save($data); This doesn't save anything, just updates the last modified date on the Category. I have tried similar to above where in the foreach loop I { $data = array(); $data["CandidateItem"]["title"] = $item; $data["CandidateItem"]["category_id"] = $categoryId; $this->CandidateItem->create($data); $this->CandidateItem->save($data); } which does save new CategoryItems but doesn't save any association data in the category_items_categories table. What am I doing wrong? Some pointer would be most welcome as all the docs appear to discuss creation of HABTM associations from a view (and therefore discuss what needs to go in there) I can find nothing on this particular use case. Thanks Conrad --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---