actionUpdate not updating non-required fields?

I’m basically using the default out of the box Yii code, but am running into something a bit odd. If you have the following code in actionUpdate() in the controller:




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


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

	{

		$editorial->attributes=$_POST['Editorial'];

		if($editorial->save())

			$this->redirect(array('admin'));

	}

	.

	.

	.



and this in the rules() fn in the model:




	return array(

		array('active, url, cover, title, body', 'required'),

		.

		.

		.



then it works fine.

But if I take "body" out of the required fields, it stops updating body when you save! Weird huh? What am I missing?

Thanks.

You should read this section of The Definitive Guide to Yii.

/Tommy

Awesome. That explains it perfectly. I found that adding any validator fixed it:


array('body', 'length', 'allowEmpty'=>true),

for example.

Now I know why.

Thanks