problem with $model->save()

I want update one attribute like ‘status’,in controller:




public function actionPublic()

{

  $model=$this->loadModel();

  //now status = 2;

  $model->status = 1;

  $model->save();

}


public function loadModel()

{

  if($this->_model===null)

  {

    if(isset($_GET['id']))

      $this->_model=Question::model()->findbyPk($_GET['id']);

    if($this->_model===null)

      throw new CHttpException(404,'The requested page does not exist.');

  }

  return $this->_model;

}



when i run action public,but the status value always is 2,not change to 1,please tell me what’s wrong.

Thank you very much!

$model->status = 1;

$model->update(‘status’);

Please show your model. Do you have any beforeSave() functions that don’t return true? Do you have save() overridden and forgot to call parent::save()?