<% if @project %> <%= render :partial => 'project_news', locals: {project: @project} %> <% elsif @course %> <%= render :partial => 'course_news', locals: {course: @course} %> <% elsif @contest %> <%= render :partial => 'contest_news', locals: {contest: @contest} %> <% end %>