nullobject
nullobject copied to clipboard
Null::Object.instance.present? # => true
Using ActiveSupport, Null::Object.instance.present? returns true, which doesn't seem right. Also blank? returns false, which again doesn't seem right.
works for me:
[37] pry(main)> Null::Object.instance.blank?
=> #<Null::Object:0x3ffe0e2359c8>
[38] pry(main)> Null::Object.instance.present?
=> false
Did you try with both ruby 1.8 and 1.9?
ouch, ruby 2.0.0-p0 actually here ;) rails 3.2.13
Ah. It could also be rail's ActiveSupport extensions that make that work too. Try it in irb.