I have a form <% form_for(@player) do |f| %> that displays the user’s password
<%= f.label :password %><br />
<%= f.text_field :password %>
I want to hide the password (just show a blank text box), and only update the password on submit if the text box is not blank. Would really appreciate any help.
In your player model (I’m assuming it’s the Player model that represents your user), this code does want you need:
And in your view, just use
password_fieldinstead of text_field. Withpassword_field, you don’t have to set the value to an empty string.