i have customized the profile controller’s load model function to load the profile of the user according to the user_id
public function loadModel($id)
{
$model=Profile::model()->find('user_id='.(int)$id);
if($model===null)
throw new CHttpException(404,'The requested page does not exist.');
return $model;
}
the update function is
public function actionUpdate($id)
{
$profileUser = $this->loadModel($id);
if(yii::app()->user->checkAccess('updateOwnProfile',array('profile'=>$profileUser))){
echo ' voila u succeeded';
$model=$this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation($model);
if(isset($_POST['Profile']))
{
$model->attributes=$_POST['Profile'];
print_r($_POST['Profile']);
if($model->validate()){
echo 'validated';
}else{
echo 'not validated';
}
if($model->save()){
$this->redirect(array('view','id'=>$model->id));
}
else{
echo 'noting happinginhhhhh';
print_r($model->getErrors()) ;
}
}
$this->render('update',array(
'model'=>$model,
));
}else{
echo 'rules are failing';
}
}
it is loading the correct profile but it is not updating it
i have validated the model there is no problem
there is no problem listed in the $form->errorSummary($model);
the print_r($model->getErrors()) is giving empty array
but the model is not saving i can’t figure out why why why???
can anyone help me out???