# 用户被移出群组后，用户标记仍然存在

**URL:** <https://meta.discourse.org/t/user-flair-remains-after-user-is-removed-from-group/197293>\
**Category:** Bug\
**Created:** [2021年七月15日 21:10 UTC](https://meta.discourse.org/t/user-flair-remains-after-user-is-removed-from-group/197293 "2021-07-15T21:10:49Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)\
**Post date:** [2021年九月16日 13:41 UTC](https://meta.discourse.org/t/user-flair-remains-after-user-is-removed-from-group/197293/15 "2021-09-16T13:41:32Z")

</div>

```ruby
User.where(flair_group_id: REPLACE_WITH_GROUP_ID).where.not(primary_group_id: REPLACE_WITH_GROUP_ID).update_all(flair_group_id: nil)

```

上述命令可以解决您的问题。请在您的 [Rails 控制台](https://meta.discourse.org/t/how-to-get-into-rails-console/77310/2?u=vinothkannans) 中运行此命令。在执行之前，请务必备份数据。

---

_[View the full topic](https://meta.discourse.org/t/user-flair-remains-after-user-is-removed-from-group/197293)._
