Reputation: 91
Job#new
<ul>
<% if current_user.jobs.any? %>
<% current_user.jobs.each do |job| %>
<li> Job ID: <%= job.id %> Recipient: <%= job.recipient %> </li>
<% else %>
<%= "You have no jobs" %>
<% end %>
<% end %>
Not sure what I'm missing here.
Upvotes: 1
Views: 4275
Reputation: 903
Try it:
<ul>
<% if current_user.jobs.any? %>
<% current_user.jobs.each do |job| %>
<li> Job ID: <%= job.id %> Recipient: <%= job.recipient %> </li>
<% end %>
<% else %>
<%= "You have no jobs" %>
<% end %>
You are opening an each
and forget close else
before
Upvotes: 5