This project is archived and is in readonly mode.
FalseClass should return false on a .presence check not nil
-
Deleted User
+1
-
Philip Arndt
- Assigned user cleared.
-
David Jones
+1
-
Jeremy Kemper
- State changed from verified to wontfix
returns nil where it should return false
Why should it? The lack of presence is
nil, andfalseis not present, like" "and[]. -
Philip Arndt
false is a valid instance of the FalseClass and so a false value is in essence present, just like how currently true is returned as a valid instance of the TrueClass for true.presence - these are different than empty string or empty array.
Currently we get:
true.presence #=> truefalse.presence #=> nilMerging this patch means that you (more consistently I think) get:
true.presence #=> truefalse.presence #=> falseifstatements will still work in the same fashion as before the only difference is that Rails no longer is hiding the actual value of false. -
Jeremy Kemper
false.blank? # => truefalse.present? # => falsePresence is universal for all objects. If an object is not
blank?,selfis returned. True and false are not special cases.
