- @subjects.each do |s|
%tr
%td= s.position
%td= s.name
%td= s.visible ? "Yes" : "No"
%td= s.pages.size
%td= link_to("Show", {:action => "show", :id => s.id}, :class => "action show")
= link_to("Edit", {:action => "edit", :id => s.id}, :class => "action edit")
= link_to("Delete", {:action => "delete", :id => s.id}, :class => "action delete")
error_msg:
非法嵌套:内容不能与%td同时出现在同一行并嵌套在其中。
我希望这三个链接——显示、编辑和删除——在同一个目录中;我该怎么做呢?
你只需要改变这个:
%td= link_to("Show", {:action => "show", :id => s.id}, :class => "action show")
= link_to("Edit", {:action => "edit", :id => s.id}, :class => "action edit")
= link_to("Delete", {:action => "delete", :id => s.id}, :class => "action delete")
:
%td
= link_to("Show", {:action => "show", :id => s.id}, :class => "action show")
= link_to("Edit", {:action => "edit", :id => s.id}, :class => "action edit")
= link_to("Delete", {:action => "delete", :id => s.id}, :class => "action delete")
您还应该从tr
缩进td
s。
供参考-我也遇到了这个问题,但罪魁祸首是我的<td>
之后的尾随空间,这是HAML的内容。