使用以下代码获取此一元+错误,请查看先前的解决方案,他们认为某些情况下缺少结尾,但事实并非如此。
请帮忙
<% if part.children.exists? %>
<% @link_text += " <b>|</b> " %>
<% part.children.each do |part_child| %>
<% if part_child.display_type == "radio" || part_child.display_type == "dropdown" || part_child.display_type == "checkbox" %>
<% if part_child.display_type == "checkbox" %>
<% @checkbox_options = "" %>
<% part_child.options.each do |o| %>
<% if o.is_default? %>
<% @co = "<span id = 'nav_option_id_" + o.id +"'>" + o.name +"</span>" %>
<% @checkbox_options += @co %>
<% end %>
<% end %>
<% @link_text = @link_text + "<b>#{part_child.name}</b> : <span id='part_child_" + part_child.id.to_s + "'>" "</span>" %>
<% else %>
<% @link_text = @link_text + "<b>#{part_child.name}</b> : <span id='part_child_" + part_child.id.to_s + "'>" + part_child.options.detect{|o| o.is_default?}.try(:name).to_s + "</span>" + " <b>|</b> " %>
<% end %>
<% end %>
<% end %>
<% end %>
我认为这是问题所在...
<% @link_text = @link_text + "<b>#{part_child.name}</b> : <span id='part_child_" + part_child.id.to_s + "'>" "</span>" %>
最后两个元素之间缺少“ +”。
<% @link_text = @link_text + "<b>#{part_child.name}</b> : <span id='part_child_" + part_child.id.to_s + "'>" + "</span>" %>
正如BrioSatse在评论中所说,插值会更好。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句