For some reason my link_to_if line works, but appears on every show view for my model (Company).
Here's the code:
<% @customers.each do |customer| %>
<li>
<%= link_to_if customer.company_id == @company.id, "#{customer.first_name} #{customer.last_name}", customer_path(customer[:id]) %>
</li>
<% end %>
The issue: I have Customer1 linked to CompanyX. When I go to CompanyZ it shows Customer1, but the link is not a hyperlink. it's just plaintext, and not even supposed to be showing up. However on CompanyX's view, the link works fine. What am I doing wrong here?