Avoid printing attributes of the nil object in Rails
You are right, you code is too verbose. This is a pretty common pattern and you have some alternatives. For example, active_support has the abstraction Object#try:

&lt;%= @person.team.try(:name) %&gt;


Another alternative is the Object#maybe proxy: https://github.com/bhb/maybe

&lt;%= @person.team.maybe.name %&gt;