This field is not supposed to be modified. I can’t create a new user as password and password_confirmation fields are required when resorting to has_secure_password on user model.
Expected behavior
I would prefer to have one password and password_confirmation fields like Rails Admin do. It’s the standard implementation of has_secure_password with a password_digest field in database.
Yes we do not support it natively. We pushed your request on our productboard.
In the meantime, you can make it work by using smart fields. You’ll need to create a smart field:
class Forest::User
include ForestLiana::Collection
collection :User
set_password = lambda do |user_params, password|
user_params[:password] = password
# Returns a hash of the updated values you want to persist.
user_params
end
field :password, type: 'String', set: set_password do
object.password_digest ? :filled : nil
end
set_password_confirmation = lambda do |user_params, password_confirmation|
user_params[:password_confirmation] = password_confirmation
# Returns a hash of the updated values you want to persist.
user_params
end
field :password_confirmation, type: 'String', set: set_password_confirmation do
object.password_digest ? :filled : nil
end
end