Further reading on
nil in Ruby & Rails
Ruby: Is nil?
- Lukasz Wrobel demystifies
nil in Ruby
Why the id of nil is 4 in Ruby
- An older post by Neeraj Singh on
a World Without Nil
If You Gaze Into nil, nil Gazes Also Into You
try(), try() again in Rails
Null Objects and Falsiness
Rails Refactoring Example: Introduce Null Object
Understanding .nil? .empty? .blank? .present? in Ruby on Rails
How To Guard Against Ruby Nil Errors
Don't Fail at Failure in Ruby
Navigating nil (Method Chaining) in Ruby
Eliminating branching, nil and attributes - let's get weird
Question: rails if object.nil? then magic '' in views?
Naught — a toolkit for building NullObject classes in Ruby
Boolean to_i feature rejection
- This is particularly interesting because Matz gives a succinct answer that explains what he intends
nil to be and
false to not be:
Ruby is not C. 0 is not false. false is not 0. nil has its role as a default value, true/false are not.