Quick question. Let’s say I have model Person and has a belong_to
relationship to model Award through award_id. As you can imagine a
person may have no award. If I just say in the template:
<%= @person.award.name %> I will get the annoying ‘nil’ error when the
template is rendered if the person does not have an award – and I
have a lot of similar situations in my template. I could write:
<%= @person.award.name if @person.award %>, I guess, but is this the
best way to do it?