Hello guys, i have one secret field for my resourc...
# avo-2
q
Hello guys, i have one secret field for my resource that is not a password field, is there some way to use like devise_password_optional config for another field?
Copy code
ruby
class ProjectResource < Avo::BaseResource
  self.devise_password_optional = true # THis option but for github_secret

  field :github_secret, as: :password
end
The problem is that if a not update this field (github_secret) in avo edit, this field is updated to a blank string
l
we don't have a field or a setting to handle that. it's an oversight on our end
I'm thinking of alternatives
maybe with a
before_save
hook
q
I think it will works, thanks
l
Hey. Apologies for the radio silence. I got dragged in a few calls and now I had to leave
Let me know if you figured it out, and if you didn’t I can try to make something tomorrow
q
before_save :remove_blank_secret def remove_blank_secret if github_secret.blank? clear_attribute_change(:github_secret) end end
This works for me, if will help anybody later
l
I didn't know about
clear_attribute_change
. thanks!