New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't assign blank values to virtual password attributes #10793
Comments
I have an outstanding pull request that changes some of this. |
Awesome, good to hear it. |
@railstutorial - it appears this behavior (not updating #10694 will still do the same thing... |
This seems expected behavior to me |
Thanks for the comments. I was worried it might have been introduced intentionally. I find the new behavior confusing, as have several readers of the book, but I've already worked around it in the latest version. |
Consider a standard User class with password and password confirmation, as in
With such a model, it is apparently not possible to assign blank values to the password or confirmation attributes. For example, with the User model shown, we can see the problem with a console session:
As we can see, the password hasn't changed, despite the assignment. As far as I can tell, this happens with
nil
and whitespace, i.e., objects for whichobj.blank?
is true. In particular, nonblank values do work:The text was updated successfully, but these errors were encountered: