There are bread crumbs in the @tracks array, I go through them
<% @tracks.map do |track| %> and inside this code lists are formed (a drop-down menu of breadcrumbs) depending on the conditions of some.
<% if track[:url] %> <%= link_to( track[:name], track[:url]) %> <% else %> <%= link_to( track[:name], slug_path(track[:slug])) %> <% end %> <ul> <%- childrens.each do |child| -%> <li> <%= link_to(child['name'], child['slug']) %> </li> <% end %> </ul> I need to put restrictions on @tracks.count-2 So that the extra ul not displayed, I am empty
map? Why noteach? You throw out return value. - D-sidemapis (for the call is in<% %>, not<%= %>); and you refer to the link (as a side effect in computer science; howputsreturnsnil, but prints something on the screen). In theory, there is enough foreach. - D-sidechildrenan empty list is displayed? So wrap it inif, checking if the list is not empty (unless childrens.empty?For example). PS: children is already a plural, the only child for it. - D-side