How To Debug Why A Validator Not Triggered?

hi, I need to know, if there is a validator not triggered, how could I debug it? or can you tell me what is wrong with the following code (the compare validator not triggered even if password not equal to password_confirm):

// new added field


public $password_confirm;


    public function safeAttributes()


    {


      return array_merge(array('password_confirm'), parent::safeAttributes());


    }


public function rules()


{


	return array(


                array('password', 'compare', 'compareAttribute'=>'password_confirm'),


	);


}

you can inspect the errors property on your model to see if there is a error being added to your model for password_confirm




[code]in your view or controller 

var_dump($model->errors);





also 


// you could add a safe validation rule instead remove this if you use the safe rule

public function safeAttributes()

{

	return array_merge(array('password_confirm'), parent::safeAttributes());

}




public function rules()

{

	return array(

		array('password', 'compare', 'compareAttribute'=>'password_confirm'),

		// safe validator

		array('password_confirm', 'safe')

	);

} 

There’s no safeAttributes() method (anymore?..).

You need to add another validation rule for password_confirm (for example, ‘safe’)