I have two models Area and Unit. Area has_many units and Unit belongs_to Area. Generated scaffolds and modified to see a list of areas when editing Units. When I create new units the area is saved without problems. But when updating with another Area it keeps to original area_id although the newly chosen area id is written to the model parameters.
Here is the code from the edit action including logging calls printing the attributes of the model: $this->_Logger->message("setting attributes",$this->Unit->getAttributes()); $this->Unit->setAttributes($this->params['Unit']); $this->_Logger->message("set attributes",$this->Unit->getAttributes()); if($this->Request->isPost() && $this->Unit->save()){ $this->_Logger->message("setting attributes",$this->Unit->getAttributes()); $this->flash_options = array('seconds_to_close' => 10); $this->flash['notice'] = $this->t('Unit was successfully '.($is_add?'created':'updated').'.'); $this->redirectTo(array('action' => 'show', 'id' => $this->Unit->getId())); }