12 ms·
> or example asking whether a variable is present? (truthy, so empty str and empty [] should return false) Actually this is kind of the whole point of #present
by lovegoblin 5y ago
> or example asking whether a variable is present? (truthy, so empty str and empty [] should return false)
Actually this is kind of the whole point of #present? - it's not just a truthiness check.
The only falsey values in Ruby are `false` and `nil`, but in the context of a Rails app you might want to treat things like "" and [] as "not present" (e.g., a user leaves a text field blank).