Searching and sorting by related model in CGridView

Comparing #2 with #3

Content

[...]
'filter'=>$model,
'columns'=>array(
'title',
'post_time',
array( 'name'=>'author_search', 'value'=>'$data->author->username' ),
        //post strictly required user but in any case that model has not required user(or another relation) you should replace with it
 
        array( 'name'=>'author_search', 'value'=>'$data->author ? $data->author->username: "-"' ),
 
array(
'class'=>'CButtonColumn',
),
),
));
```
[...]