Ruby Safe Operator Tip
In my current work, I’m using (abusing) of the ruby safe operator &, which is a native implementation of the null pattern, for example, in a chain of messages: user.billings.first.cost It could be thrown an error when for example the billings of a user is empty and first returns a nil object and then nil.cost creates an Exception. With the safe operator & this avoids the error: user.billings.first&.cost # => 5.3838 So, in the last part of the code using the & is not causing an error because the safe operator logic is: ...