Haml语法错误|非法元素:类和id必须具有值

时间:2015-01-13 18:13:08

标签: ruby-on-rails ruby haml

%h3 Regulations

%table.table.table-striped
%thead
%tr
  %th.cls-th-100 Name
  %th.cls-th Title
  %th
  %th
%tbody
- @regulations.each do |regulation|
  %tr
    %td= link_to regulation.name, admin_regulation_path(regulation)
    %td= regulation.title
    %td
      = link_to edit_admin_regulation_path(regulation) do
        %span.glyphicon.glyphicon-edit
    %td
      = link_to admin_regulation_path(regulation), method: :delete, data: { confirm: 'Are you sure?'} do
        %span.glyphicon.glyphicon-trash

我正在尝试注释掉glyphicon-edit和glyphicon-trash,但是继续收到错误非法元素:类和ID必须具有值。

1 个答案:

答案 0 :(得分:0)

关于关闭dos和遗漏的一些令人困惑的评论在那里...... haml的一个要点是你不需要关闭你的标签(或控制语句) - haml它适合你。

要在haml中注释,请在-#

行前面
-# %span.glyphicon.glyphicon-edit

这是纯粹的红宝石。破折号启动一行ruby代码,#是ruby中的注释符号。