View from multiple models

Hi All,

Very new to Yii but tried looking at other similar topics with no success.

I have 2 table c_task, and tay_task_priority. Table c_task includes an id from the other table.

In the view I want to display the name in the table tay_task_priority according to the relevant id.

I get the CGridView with the information from the c_task table while the tay_task_priority column is empty.

My View is:

<?php

&#036;this-&gt;widget('zii.widgets.grid.CGridView', array(


'id'=&gt;'ctask-grid',


'dataProvider'=&gt;&#036;model-&gt;tay_search(),

// ‘filter’=>$model,

'columns'=&gt;array(


	'description',


	'priority',


	'tay_task_priority.priority_name',


	array( 'class'=&gt;'CButtonColumn', ),


),

));

?>

Main model includes my search function as follows:

public function tay_search()


{





	&#036;criteria=new CDbCriteria;


		


	&#036;criteria-&gt;alias = 'ctask';


	


	&#036;criteria-&gt;join = 'JOIN tay_task_priority ON tay_task_priority.priority_id=ctask.priority';


	


	&#036;criteria-&gt;compare('user_id',Yii::app()-&gt;user-&gt;getState('appuserid'));


	


	return new CActiveDataProvider( &#036;this , array('criteria'=&gt;&#036;criteria, ));


	


}

The Controller piece is:

public function actionTayAdmin()


{


	&#036;model=new CTask('search');


	&#036;model-&gt;unsetAttributes();  // clear any default values


	if(isset(&#036;_GET['CTask']))


	&#036;model-&gt;attributes=&#036;_GET['CTask'];





	&#036;this-&gt;render('tayadmin',array('model'=&gt;&#036;model,


	));


}

Can someone tell me how to do it?

Thanks,

Yoavre

BTW, of course I have the relations in my model as follows:

public function relations()


{


	return array(


				'tay_task_priority' =&gt;array(self::HAS_ONE, 'TayTaskPriority', 'priority_id'		,'select'=&gt;'priority_name'), );


}