Last Updated: February 25, 2016
· danielpclark

Create an ActiveAdmin account by Cloning a Devise User account

Need to create an admin account for ActiveAdmin but don't want to go through account creation and password re-entry twice? Use this method to get the job done.

def new_admin_user_from_devise(user_id)
  user = User.find(user_id)

  unwanted = ["id", "sign_in_count", "created_at", "updated_at", "current_sign_in_at", "last_sign_in_at", "current_sign_in_ip", "last_sign_in_ip"] {|i|
      { i => user[i] }
  ).save(validate: false)


This copies your already encrypted password account over. Works great!