public function actionCreate() { $model = new CommentSetting(); if (isset($_POST['CommentSetting'])) { $model->setAttributes($_POST['CommentSetting']); try { if ($model->save()) { if (isset($_GET['returnUrl'])) { $this->redirect($_GET['returnUrl']); } else { $this->redirect(array('/comments/settings')); } } } catch (Exception $e) { $model->addError('', $e->getMessage()); } } elseif (isset($_GET['CommentSetting'])) { $model->attributes = $_GET['CommentSetting']; } $this->render('create', array('model' => $model)); }