It may be obvious to some, but it took me a while to put it together. After hours of trying various solutions and workarounds and searching all over the place, I went deeper into Rails checks and found several constructs that make this very easy when combined.
All I had to do was set up a check for the create action and one for the update action and allow whitespace for the update.
validates :password, length: { in: 6..128 }, on: :create
validates :password, length: { in: 6..128 }, on: :update, allow_blank: true
With this, I get the behavior I want, and these are just two short lines of code.
Note:
First I tried this way:
validates :password, length: { in: 6..128 }, on: :create
, . / ( ?) .