top | item 28330626

(no title)

lovegoblin | 4 years 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).

discuss

order

No comments yet.