HAML - "expecting end-of-input" Ruby 错误

HAML - "expecting end-of-input" Ruby error

谁能看出为什么我的代码会出现这个错误?

如果我删除错误捕获它工作正常但看不到错误捕获的问题。

谢谢

 = simple_form_for @pic, html: { multipart: true } do |f|
      - if @pic.errors.any?
        #errors
          %h2 
          = pluralize(@pic.errors.count, "error")
            prevented this Pic from saving
            %ul
              - @pic.errors.full_message.each do |msg|
                %li= msg

      .form-group
        = f.input :title, input_html: { class: 'form-control' }
      .form-group
        = f.input :description, input_html: { class: 'form_control' }

      = f.button :submit, class: "btn btn-info"

你的代码有缩进问题,试试这个

= simple_form_for @pic, html: { multipart: true } do |f|
  - if @pic.errors.any?
    #errors
      %h2 
        = pluralize(@pic.errors.count, "error")
        prevented this Pic from saving
        %ul
          - @pic.errors.full_message.each do |msg|
            %li= msg

  .form-group
    = f.input :title, input_html: { class: 'form-control' }
  .form-group
    = f.input :description, input_html: { class: 'form_control' }

  = f.button :submit, class: "btn btn-info"

希望对您有所帮助!