Just trying to update a single field within a function called from its
associated model:

I'm calling 'removeFromGroup' in Ingredients controller from my
IngredientGroups controller.

I basically want to remove the ingredient from the group, so set the
ingredient_group_id to null.

        function removeFromGroup($id = null, $group_id = null) {
                if (!$id) {
                        $this->Session->setFlash(__('Invalid id for 
Ingredient', true));
                        $this->redirect(array('controller'=> 'IngredientGroups',
'action'=>'view', $group_id));
                }

                $this->data = $this->Ingredient->read(null, $id);

                $this->data['ingredient_group_id'] = null;
                $this->Ingredient->save($this->data);
                $this->redirect(array('controller'=> 'IngredientGroups',
'action'=>'view', $group_id));

        }

There's my function. It just won't save the ingredient_group_id to
null. Not sure what I'm doing wrong. Thanks!


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to