3 ms·
Agree, love this syntax obj = nil obj&.gsub("f","g") # => nil obj = "food" obj&.gsub("f","g") # => "good" Unfortunately this is not likely second na
by rubyfan 9y ago
Agree, love this syntax
obj = nil
obj&.gsub("f","g") # => nil
obj = "food"
obj&.gsub("f","g") # => "good"
Unfortunately this is not likely second nature and will continue to bite us, especially where our expectations about AR models are not well thought out. A wrapping class for nillables might force safe access of AR attributes.