public function actionCreate() { $model = new Unidad(); if (isset($_POST['Unidad'])) { $model->setAttributes($_POST['Unidad']); try { if ($model->save()) { $this->setFlash('notice', array('title' => 'Mensaje', 'content' => 'Se grabó correctamente.')); $this->redirect(array('manage')); } } catch (Exception $e) { $model->addError('', $e->getMessage()); } } elseif (isset($_GET['Unidad'])) { $model->attributes = $_GET['Unidad']; } $this->render('create', array('model' => $model)); }