public function actionCreate() { $model = new RoleGroups(); if (isset($_POST['RoleGroups'])) { $model->attributes = $_POST['RoleGroups']; $model->role = implode("||", $_POST['actions']); if ($model->save()) { if (Yii::app()->request->isAjaxRequest) { $this->renderPartial('view', array('model' => $this->loadModel($model->id)), false, true); Yii::app()->end(); } $this->redirect(array('view', 'id' => $model->id)); } } if (Yii::app()->request->isAjaxRequest) { $this->renderPartial('create', array('model' => $model), false, true); Yii::app()->end(); } $this->render('create', array('model' => $model)); }