title: Yii Model has an invalid validation rule. Won't insert to multiple models
body: <p>I'm trying to create a user and I'm able to insert into my SystemUsers model and Parties model but now when I add code to try making an insert to my Persons model, I get the erros Persons has an invalid validation rule. The rule must specify attributes to be validated and the validator name.</p>
  
  <p>Is there anything wrong with my controller code?</p>
  
  <pre><code> public function actionCreate()
      {
          $model = new SystemUsers;
          $modelParties = new Parties;
          $modelPersons = new Persons;
  // Uncomment the following line if AJAX validation is needed
  // $this-&gt;performAjaxValidation($invoice);
  
  if (isset($_POST['SystemUsers']))
      {
  
          $model-&gt;attributes = $_POST['SystemUsers']; 
          Yii::app()-&gt;db-&gt;createCommand("insert into parties (party_type_id) values ('1')")-&gt;execute();           
          $id = Yii::app()-&gt;db-&gt;lastInsertId; //The id from parties is a fk of system users
  
          $model-&gt;password = md5($model-&gt;password);//this works
          $model-&gt;party_id = $id; //this works
          $modelPersons-&gt;party_id = $id; //I believe errors start to occur startin here
          $modelPersons-&gt;email = $model-&gt;username;
          $modelPersons-&gt;save();
  
  
  
          if($model-&gt;save())
              echo "&lt;script&gt;alert('User Created');&lt;/script&gt;";
  
  //      }
          else $this-&gt;redirect(array('views22','id'=&gt;$model-&gt;id));
   }
  
  $this-&gt;render('create',array(
    'parties'=&gt;$modelParties,
    'model'=&gt;$model,
  ));
   }
  </code></pre>
  
  <p>These are the rules for my Persons model::</p>
  
  <pre><code>public function rules()
  {
      // NOTE: you should only define rules for those attributes that
      // will receive user inputs.
      return array(
          array('party_id, email, company_name, last_name, middle_name, gender, dob_year, dob_month, dob_day, nickname, language, address, country, location, moderator, from_date_location, to_date_location'),
          array('dob_year, dob_month, dob_day, language, country, location', 'numerical', 'integerOnly'=&gt;true),
          array('party_id', 'length', 'max'=&gt;20),
          array('email', 'length', 'max'=&gt;100),
          array('company_name, last_name, middle_name, nickname', 'length', 'max'=&gt;255),
          array('gender', 'length', 'max'=&gt;6),
          array('sub_admin, moderator', 'length', 'max'=&gt;1),
          array('image', 'safe'),
          // The following rule is used by search().
          // Please remove those attributes that should not be searched.
          array('party_id, email, company_name, last_name, middle_name, gender, image, dob_year, dob_month, dob_day, nickname, language, address, country, location, sub_admin, moderator, from_date_location, to_date_location', 'safe', 'on'=&gt;'search'),
      );
  }
  </code></pre>