Rake task for merging users

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

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?

1 Like