Skip to content

Commit

Permalink
Updating test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
nateabele committed Jun 18, 2010
1 parent 3bf6a71 commit 629e5a8
Showing 1 changed file with 13 additions and 24 deletions.
Expand Up @@ -96,39 +96,28 @@ public function index() {
return compact('posts');
}
public function view($id = null) {
$post = Post::find($id);
public function view() {
$post = Post::first($this->request->id);
return compact('post');
}
public function add() {
if (!empty($this->request->data)) {
$post = Post::create($this->request->data);
if ($post->save()) {
$this->redirect(array(
'controller' => 'posts', 'action' => 'view',
'args' => array($post->id)
));
}
}
if (empty($post)) {
$post = Post::create();
$post = Post::create();
if (($this->request->data) && $post->save($this->request->data)) {
$this->redirect(array('Posts::view', 'args' => array($post->id)));
}
return compact('post');
}
public function edit($id = null) {
$post = Post::find($id);
if (empty($post)) {
$this->redirect(array('controller' => 'posts', 'action' => 'index'));
public function edit() {
$post = Post::find($this->request->id);
if (!$post) {
$this->redirect('Posts::index');
}
if (!empty($this->request->data)) {
if ($post->save($this->request->data)) {
$this->redirect(array(
'controller' => 'posts', 'action' => 'view',
'args' => array($post->id)
));
}
if (($this->request->data) && $post->save($this->request->data)) {
$this->redirect(array('Posts::view', 'args' => array($post->id)));
}
return compact('post');
}
Expand Down

0 comments on commit 629e5a8

Please sign in to comment.