投稿を編集したいのですが、http://... /posts/edit/2 にアクセスすると、投稿が更新されたという Flash メッセージが表示されるだけです。編集フォームが表示されない...
function edit($id = NULL) {
$this->Post->id = $id;
if($this->request->is('post')){
$this->request->data = $this->Post->read();
}else {
if($this->Post->save($this->request->data)){
$this->Session->setFlash('The post has been updated');
$this->redirect(array('action'=>'index'));
}
}
}
私の編集ページ
<h2>Edit post</h2>
<?php
echo $this->Form->create('post',array('action'=>'edit'));
echo $this->Form->input('title');
echo $this->Form->input('body');
echo $this->Form->input('id', array('type'=>'hidden'));
echo $this->Form->end('Edit Post');
?>