# Rake task for merging users

**URL:** https://meta.discourse.org/t/rake-task-for-merging-users/89086
**Category:** Announcements
**Tags:** new-feature, merge-user
**Created:** [March 1, 2018, 12:56pm UTC](https://meta.discourse.org/t/rake-task-for-merging-users/89086 "2018-03-01T12:56:29Z")
**Posts on this page:** 1
**Showing post:** 33

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [August 10, 2018, 9:03pm UTC](https://meta.discourse.org/t/rake-task-for-merging-users/89086/33 "2018-08-10T21:03:47Z")

</div>

Sure, this can be done in the rails console within the container.

```plaintext
rails c

# restrict to secondary emails, just in case you try to delete the wrong email
UserEmail.where(email: "foo@example.com", primary: false).destroy_all

# probably not needed, but better safe than sorry
EmailToken.where(email: "foo@example.com").destroy_all

```

---

_[View the full topic](https://meta.discourse.org/t/rake-task-for-merging-users/89086)._
