@ChiaraAni Did you try it?
user.update!(password: nil)
and user.update!(password: "")
and user.update!(password: " ")
will all fail the validation, but user.update(name: 'Joana')
works fine because the password is not being updated. You do not need to allow nil. Maybe the misunderstanding here is that user.update(name: "Foo")
and user.update(name: "Foo", password: nil)
are different. There's a very important difference between passing in a key with a value of nil and not passing in a key at all.