<% if event.races_with_results.many? %>
<div class="event_info">
  <table class="event_races">
    <tbody>
      <%- event.races_with_results.sort.each_row do |first_race, second_race| -%>
      <tr>
        <td class="race">
          <%= link_to first_race.name, "#race_#{first_race.id}" %>
        </td>
        <td class="race">
          <%= link_to(second_race.name, "#race_#{second_race.id}") if second_race %>
        </td>
      </tr>
      <%- end -%>
    </tbody>
  </table>
</div>
<%- end -%>

<% if races.select(&:results_present?).many? %>
<div class="event_info">
  <table class="event_races">
    <tbody>
      <%- races.select(&:results_present?).sort.each_row do |first_race, second_race| -%>
      <tr>
        <td class="race">
          <%= link_to first_race.name, "#race_#{first_race.id}" %>
        </td>
        <td class="race">
          <%= link_to(second_race.name, "#race_#{second_race.id}") if second_race %>
        </td>
      </tr>
      <%- end -%>
    </tbody>
  </table>
</div>
<%- end -%>

Use races local, not event.races
Use races local, not event.races
