Browse Source

Allow user admin update without password

pull/114/head
baarkerlounger 4 years ago
parent
commit
e8c864632f
  1. 7
      app/admin/admin_users.rb
  2. 7
      app/admin/users.rb

7
app/admin/admin_users.rb

@ -1,6 +1,13 @@
ActiveAdmin.register AdminUser do
permit_params :email, :password, :password_confirmation
controller do
def update_resource(object, attributes)
update_method = attributes.first[:password].present? ? :update_attributes : :update_without_password
object.send(update_method, *attributes)
end
end
index do
selectable_column
id_column

7
app/admin/users.rb

@ -1,6 +1,13 @@
ActiveAdmin.register User do
permit_params :name, :email, :password, :password_confirmation, :organisation_id
controller do
def update_resource(object, attributes)
update_method = attributes.first[:password].present? ? :update_attributes : :update_without_password
object.send(update_method, *attributes)
end
end
index do
selectable_column
id_column

Loading…
Cancel
Save