How should I write:
if @parent.child.grand_child.attribute.present? do_something
without cumbersome nil checkings to avoid exception:
For fun, you could use a fold:
[:child, :grandchild, :attribute].reduce(@parent){|mem,x| mem = mem.nil? ? mem : mem.send(x) }
but using andand is probably better, or ick, which I like a lot and has methods like try and maybe.
try
maybe