Some problem with scenario

Hello guys, I am having a problem with scenario usage:

			array('password', 'required', 'on'=>'register'),


			array('password', 'required', 'on'=>'update_senha'),


			


			array('password_repeat', 'required', 'on'=>'update_senha',


				  'message'=>'Confirme a senha.'),


			array('password_repeat', 'required', 'on'=>'register',


				  'message'=>'Confirme a senha.'),





			array('password', 'compare', 'compareAttribute'=>'password_repeat','on'=>'register',


				  'message'=>'As senhas devem ser iguais.'),


			array('password', 'compare', 'compareAttribute'=>'password_repeat','on'=>'update_senha',


				  'message'=>'As senhas devem ser iguais.'),

My rules only works when I dont use scenario:

array('password', 'required'),
				$user = new User();


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


				$user->password_repeat = $_POST['password_repeat'];


				if($user->validate('update_senha')) {


					if($user->save()){


						Yii::app()->user->setFlash('success','Senha alterada com sucesso!');


					}


				}

Thanks

I just resolve it.

I was using the version in SVN. I changed the reference to the last one stable.

Just a thought but you don;t need to redeclare your rule twice if it applies to more than one scenario:



<?php


array('password', 'required', 'on'=>'register'),


array('password', 'required', 'on'=>'update_senha'),


Could become:



<?php


array('password', 'required', 'on'=>'register, update_senhar'),


(note I can't remember if you need a comma between different rules, form memory you do)

Chris