Displaying name instead of the ID in GridView?

In the my category table I have



How do I display the category_name instead of ID in the Ticket index.php GridView.

Ticket model:

public function getCategory0()


        return $this->hasOne(Category::className(), ['id' => 'category_id']);


I have tried doing


                'attribute' => 'category_id',

                'value' => 'category.name'


But the results gives me a value "Not Set" instead of the category_name


                'attribute' => 'category_id',

                'value' => 'category0.category_name'


Oh I see, that was easy! Thanks.

About GridView… you must read about eager loading for better performance: