I write 2 method, one with ternary operator and one with if..else..end.
def test_a()
return (a.blank? or a.body.blank?) ? {} : a.body
end
def test_b()
if a.blank? or a.body.blank?
return {}
else
return a.body
end
end
I think both of them seem to be the same.
But in RubyMine it show warning at a.body
of ternary :
Nil dereference may occur ruby in ternary operator
Am I using the wrong syntax?