# 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:** 20

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [June 4, 2018, 6:14pm UTC](https://meta.discourse.org/t/rake-task-for-merging-users/89086/20 "2018-06-04T18:14:01Z")

</div>

Is there something easier that I should do?  
I need to keep the old username with the new email. The staged user is the real problem. Perhaps I should just delete the staged user, but then I don’t have an easy way to reply to them to tell them what happened.

It’s pretty cumbersome to merge[‘newname\_newemail’,'oldname\_bogusemail"] and then have to do something like

```ruby
u=User.find_by_username['oldname_bogusemail']
ue=UserEmail.where(user_id: u.id)
ue[0].destroy
ue[1].active=true
ue[1].save

```

is there some easier way that I’m missing?

---

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