ActiveAdmin.register AdminUser do
  menu :priority => 999

  before_destroy :raise_if_last
  def raise_if_last
    if AdminUser.count < 2
      raise "Can't delete last admin user"
    end
  end

  index do

    column :email
    column :current_sign_in_at
    column :last_sign_in_at
    column :sign_in_count
    default_actions
  end

  form do |f|
    f.inputs "Admin Details" do
      f.input :email
    end
    f.buttons
  end
end
