The @group
in your case doesn't have a leader
. That variable is nil, so when you try to get the nil leaders name it errors.
You can enclose that portion of the page in an if block to make sure you don't get errors:
<% if @group.leader.nil? %>
This group has no leader
<% else %>
<%= @group.leader.last_name %>
<% end %>