Quick question:
I have this function to toggle an 'active' field un a project model,
function admin_toggleactive($id = null){
$this->layout = 'ajax';
$this->autoRender = false;
if ($id) {
$this->id = $id;
}
if (!$this->id) return;
$project = $this->Project->read();
if($project['Project']['active']=='1'){
$this->Project->saveField('active','0');
}
else{
$this->Project->saveField('active','1');
}
$this->data = $this->Project->read();
$this->render('../elements/project_set_unset_active');
}
Now this wont work, the data returned to the element is the same data
(without the field toggled). BUT if I replace this line
$this->data = $this->Project->read();
to
$this->data = $this->Project->findById($id);
the element will be rendered with the new data (the actual value of
the toggled field).
Why does this happen ? Is this the only way to work around this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---