diff --git a/classes/App/Controller/fairies.php b/classes/App/Controller/fairies.php index b4b4f7b..ea201f4 100644 --- a/classes/App/Controller/fairies.php +++ b/classes/App/Controller/fairies.php @@ -61,14 +61,8 @@ public function action_edit() { $id = $this->request->param('id'); $fairy = $this->pixie->orm->get('fairy')->where('id', $id)->find(); - $this->view->fairy = $fairy; - if($fairy->loaded()){ - - - $this->request->method == 'POST'; + if($this->request->method == 'POST'){ - //Create a new fairy - $fairy = $this->pixie-> orm->get('fairy'); //Set her name from the form POST data $fairy->name = $this->request->post('name'); @@ -78,13 +72,9 @@ public function action_edit() { //Save her $fairy->save(); - - - - //And redirect the user back to the list - return $this->redirect('/'); } + $this->view->fairy = $fairy; //Show the form $this->view->subview = 'edit'; } @@ -108,4 +98,4 @@ public function action_delete() { } -} \ No newline at end of file +}