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:


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



// ‘filter’=>$model,





	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';




	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






Can someone tell me how to do it?



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'), );