Plugin om volledige naam alleen te tonen aan gebruikers van dezelfde groep

The GroupUser model contains the Group membership by User.

You want something like: GroupUser.where(user_id: current_user.id) to return the Group ids for the current user.

That will give you an Active Record Relation.

Then you might want to map it into an array:

GroupUser.where(user_id: myuser.id).map {|gu| gu.group_id}

Follow the same approach for your featured user.