Solution For An Error

Refer to the code in the actionUpdate of a relation scenario for tables:

public function actionUpdate($id)

{


	$model=$this->loadModel($id);





	// Uncomment the following line if AJAX validation is needed


	// $this->performAjaxValidation($model);





	if(isset($_POST['User']))


	{


		$model->attributes=$_POST['User'];


		if($model->save())


		{


			$model->person->attributes=$_POST['Person'];


			$model->person->save();


			


			$this->redirect(array('view','id'=>$model->id));


		}


	}


	$this->render('update',array('model'=>$model,


	));


}

The error proved to be hell of a thing but i realized it arose as a result of table persorn(profile for user) not having a PRIMARY KEY. The tables User and Person have a relation through a FOREIGN KEY. For one to UPDATE the user the tables must be both having a primary key.