Hi folks,
I start my studies with Yii fw and did a activerecord model to test and I have some questions about validations and the models structure:
- 
whenever I need do a compare validation (to create a user for exemple), I need create a safeAttributes function to put all my table attributes? 
- 
I aways need put the public variables on the top of my models to it working correctly? 
- 
I aways need to create a methods model() and tablename() in my models? 
here is my actual model:
class Test extends CActiveRecord
{
  /**
   * Returns the static model of the specified AR class.
   * @return CActiveRecord the static model class
   */
  public static function model($className=__CLASS__)
  {
    return parent::model($className);
  }
  /**
   * @return string the associated database table name
   */
  public function tableName()
  {
    return 'Test';
  }
  
  public function safeAttributes()
  {
    return array('email_repeat, name, email');
  }
  public function rules()
  {
    return array( array('email', 'compare', 'compareAttribute' => 'email_repeat', 'on' => 'create'),
                  array('name, email, email_repeat', 'required'),
                  array('email', 'email') );
  }
  
}
and here is my controller:
  class TestController extends CController
  {
    public function actionCreate()
    {
      $test = new Test;
      $test->scenario = 'create';
      if(isset($_POST['Test'])) 
      {
        $test->attributes = $_POST['Test'];
        if($test->save()) $this->redirect(Yii::app()->user->returnUrl);
      }
      
      $this->render('test', array('test' => $test));
    }
  }
Sorry for my limited English.
Thanks.