HAML:语法错误,意外的keyword_ensure,期待$ end

时间:2014-07-09 23:55:00

标签: ruby-on-rails ruby haml

获得上述错误(列出的错误行号是在文件结尾之后)

%H1= 'Week '+@week
-@days.each |day| #do
  %H2= 'Day '+day
  %table{:id => "day_#{day}"}
    %thead
      %tr
        %th Back Squat (reps)
        %th %1RM
        %th Weight 
        %th Front Squat (reps)
        %th %1RM
        %th Weight 
    %tbody
      -@workout[day].each |set| #do
        %tr
          %td= set.first.reps
          %td= 100 * set.first.percentage 
          %td= set.first.percentage * @bs_1rm
          -unless set.last.nil? 
            %td= set.last.reps
            %td= 100 * set.last.percentage 
            %td= set.last.percentage * @fs_1rm
          -else
            %td/
            %td/
            %td/

有什么想法吗?在HAML中,它通常是缩进问题,但我没有看到它......

1 个答案:

答案 0 :(得分:3)

此:

-@days.each |day| #do

应该是:

- @days.each do |day|

使用haml,您不会end阻止,但您必须使用do

打开它