public function actionCreate() { $model = new BeneficiaryAttribute(); if (isset($_POST['BeneficiaryAttribute'])) { $model->setAttributes($_POST['BeneficiaryAttribute']); if ($model->save()) { if (Yii::app()->getRequest()->getIsAjaxRequest()) { Yii::app()->end(); } else { $this->redirect(array('view', 'id' => $model->id)); } } } $this->render('create', array('model' => $model)); }