# Não é mais possível atribuir flair de avatar definindo o grupo primário

**URL:** https://meta.discourse.org/t/can-no-longer-assign-avatar-flair-by-setting-primary-group/206185
**Category:** Support
**Tags:** rails-console
**Created:** [Outubro 15, 2021, 9:24pm UTC](https://meta.discourse.org/t/can-no-longer-assign-avatar-flair-by-setting-primary-group/206185 "2021-10-15T21:24:41Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [Outubro 28, 2021, 7:11am UTC](https://meta.discourse.org/t/can-no-longer-assign-avatar-flair-by-setting-primary-group/206185/2 "2021-10-28T07:11:19Z")

</div>

Isso obriga os membros do grupo a usar o avatar do grupo:

```ruby
rails c
 target_group = Group.find_by_name("=GroupSlug=")
 users = User.joins(:group_users).where(group_users:{group_id: target_group.id})
 users.each do |u|
  u.flair_group_id = target_group.id
  u.save
 end
Exit

```

---

_[View the full topic](https://meta.discourse.org/t/can-no-longer-assign-avatar-flair-by-setting-primary-group/206185)._
