O grupo no qual você está postando é um grupo da Usenet. As mensagens postadas neste grupo farão com que o seu e-mail fique visível para qualquer pessoa na internet.
Estou fazendo uma galeria com o cake, e o que me ocorre é o seguinte, quando vou editar uma galeria, ao clicar em update, ele me faz um insert ao invez do update, olhem o action dentro do controller galleries_controller.php
function admin_edit($id = null) { $this->layout='admin'; if (!$id && empty($this->data)) { $this->Session->setFlash(__('Invalid Gallery', true)); $this->redirect(array('action'=>'index'));
}
if (!empty($this->data)) { if ($this->Gallery->save($this->data)) { $this->Session->setFlash(__('The Gallery has been saved', true)); $this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash(__('The Gallery could not be saved. Please, try again.', true));
} }
if (empty($this->data)) { $this->data = $this->Gallery->read(null, $id);
> Estou fazendo uma galeria com o cake, e o que me ocorre é o seguinte,
> quando vou editar uma galeria, ao clicar em update, ele me faz um insert ao
> invez do update, olhem o action dentro do controller
> galleries_controller.php
> function admin_edit($id = null) {
> $this->layout='admin';
> if (!$id && empty($this->data)) {
> $this->Session->setFlash(__('Invalid Gallery', true));
> $this->redirect(array('action'=>'index'));
> }
> if (!empty($this->data)) {
> if ($this->Gallery->save($this->data)) {
> $this->Session->setFlash(__('The Gallery has been saved', true));
> $this->redirect(array('action'=>'index'));
> } else {
> $this->Session->setFlash(__('The Gallery could not be saved. Please, try
> again.', true));
> }
Concordo com o Danilo. Ve se você não está esquecendo um input hidden com name="data[Gallery][id]" Voce tem que colocar o id do registro que voce queira dar o update dentro deste input.
Sem querer ser chato, mas voce poderia dar uma otimizada nesse código né? Talvez usar isso:
function admin_edit($id = null) { $this->layout='admin';
if (!empty($this->data)) { if ($this->Gallery->save($this->data)) { $this->Session->setFlash(__('The Gallery has been saved', true)); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash(__('The Gallery could not be saved. Please, try again.', true)); } } else { if (!$id) { $this->Session->setFlash(__('Invalid Gallery', true)); $this->redirect(array('action'=>'index')); }