|
|
|
ActiveAdmin.register AdminUser do
|
|
|
|
permit_params :email, :phone, :password, :password_confirmation
|
|
|
|
|
|
|
|
controller do
|
|
|
|
def update_resource(object, attributes)
|
|
|
|
update_method = attributes.first[:password].present? ? :update : :update_without_password
|
|
|
|
object.send(update_method, *attributes)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
index do
|
|
|
|
selectable_column
|
|
|
|
id_column
|
|
|
|
column :email
|
|
|
|
column "Phone Number", :phone
|
|
|
|
column :current_sign_in_at
|
|
|
|
column :sign_in_count
|
|
|
|
column :created_at
|
|
|
|
actions
|
|
|
|
end
|
|
|
|
|
|
|
|
filter :email
|
|
|
|
filter :phone
|
|
|
|
filter :current_sign_in_at
|
|
|
|
filter :sign_in_count
|
|
|
|
filter :created_at
|
|
|
|
|
|
|
|
form do |f|
|
|
|
|
f.inputs do
|
|
|
|
f.input :email
|
|
|
|
f.input :phone
|
|
|
|
f.input :password
|
|
|
|
f.input :password_confirmation
|
|
|
|
end
|
|
|
|
f.actions
|
|
|
|
end
|
|
|
|
end
|