3 ms·
I am aware of where it's used, and I am aware it can be convenient, although I am not very enthusiastic about using it. > I suspect it's related to HTML forms
by spoiler 11y ago
I am aware of where it's used, and I am aware it can be convenient, although I am not very enthusiastic about using it.
> I suspect it's related to HTML forms only including successful controls
Yeah, this is a good point, since an unchecked checkbox isn't transmitted in a standard HTML form, but Rails does add a hidden input element with the value false; so I guess #blank? does somewhat increase readability here, but this could've and should've been fixed in a better way (a few ideas come to mind).
Don't get me wrong, I probably used #blank? (and might in the future) just for the sake of convenience. However, it makes me feel guilty when I do, because it could subtly introduce and hide bugs due to lack of more adequate checks.