CGridView not works with other tables

Hi, I don’t know what is the problem…

I have 2 models, "Colecciones" and "Modelos". This CGridView is about listing "Modelos". This table has an atribute named id_coleccion than match with the same atributte in "Colecciones" table.

I want to show Colecciones->name instead of Modelos->id_coleccion.

This code works ok showing Modelos->id_coleccion:


$this->widget('zii.widgets.grid.CGridView', array(

	'id'=>'modelos-grid',

	'dataProvider'=>$model->search(),	

	'columns'=>array(

		'id_modelo',

		'slug',

		 array(

			'name'=>'id_coleccion',

			'header'=>'Colección',			

			'value'=>'$data->id_coleccion',

			'type'=>'raw',

		),	

		'modelo',		

		array(

			'class'=>'CButtonColumn',

		),

	),

));

But this not…


$this->widget('zii.widgets.grid.CGridView', array(

	'id'=>'modelos-grid',

	'dataProvider'=>$model->search(),	

	'columns'=>array(

		'id_modelo',

		'slug',

		 array(

			'name'=>'id_coleccion',

			'header'=>'Colección',			

			'value'=>'$data->colecciones->name',

			'type'=>'raw',

		),	

		'modelo',		

		array(

			'class'=>'CButtonColumn',

		),

	),

));

Yii returns "Modelos"."colecciones" is not defined.

Ok, I don’t have relations like:


return array(		  

		  'colecciones'=>array(self::BELONGS_TO, 'Colecciones', 'id_coleccion'),

		);

Now works!