ここでユーザー認証の Cakephp チュートリアルを終了しようとしています。http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html
UsersController のコードのチャンクを見ると、編集のアクションが表示されます。彼らが提供する唯一のビューは add.ctp のためのものなので、残りのビューを完成させようとしています。すでにインデックスを作成しましたが、編集ビューで何が起こっているのかわかりません。
users/edit に移動すると、次のメッセージが表示されます
Error: The requested address '/cake/users/edit' was not found on this server.
ユーザー フォルダーに edit.ctp として保存されているページがあるため、このメッセージが表示される理由がわかりません。
ちなみにUsersControllerの編集機能はこちら
public function edit($id = null) {
$this->User->id = $id;
if (!$this->User->exists()) {
throw new NotFoundException(__('Invalid user'));
}
if ($this->request->is('post') || $this->request->is('put')) {
if ($this->User->save($this->request->data)) {
$this->Session->setFlash(__('The user has been saved'));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The user could not be saved. Please, try again.'));
}
} else {
$this->request->data = $this->User->read(null, $id);
unset($this->request->data['User']['password']);
}
}
別のビューを作成して編集機能に渡すだけですか? 追加機能を使用してユーザーを追加できる理由がわかりませんが、自分のパスワード/ユーザー名/ユーザー属性を編集できません。