but i can't get the name of the group that user belong to. I understand how to create the element with this relation, but i don't understand how to call the elements from each table. I have the table users, with various columns and one is group_id And the table groups with id and name. I need to read the user data and show group name not group id.
Which means the name can be accessed using $user->group->name.
Note that it will not use the result of your own Auth_Group query, and it will run an additional query for each of the users listed in your view, because you did not query the relation.
So if you need the related data for each record, do
You pass the User structure as objects, so $user->group->name should work fine.
You probably only have to check in your view that $user->group is an object, which it isn't if the user does not have a group assigned, or has assigned a group that does not exist.