HAML - 语法错误,意外的keyword_ensure

时间:2012-02-29 17:32:44

标签: ruby-on-rails-3 templates view haml

在下面的代码部分中,我仍然收到此错误:

syntax error, unexpected keyword_ensure, expecting $end):
17:       %input.btn.btn-primary{:name => "commit", :type => "submit", :value => "Set As Profile Picture"}/

代码:

#settings_photos_window.wide_width.modal.fade
  = form_tag '/photos/set_avatar', :method => 'post' do
    .modal-header
      %a.close{"data-dismiss" => "modal"} ×
      %h3 Choose Your Profile Picture
    #choose_profile_pic.modal-body
      = hidden_field_tag 'photo[avatar]', ((@cur_avatar) ? @cur_avatar.id : '')
      - @settings_photos.each_slice(2) do |slice|
        .row{:style => "text-align: left;"}
        - slice.each do |photo|
          - (photo.avatar == 1) ? (bg_color = 'background: #28AD4B;') : (bg_color = 'background: #fff;')
            .span5.choose_picture{:style => "cursor: pointer; margin-right: 40px;"}
              %div
                = image_tag(photo.photo.url(:thumb), :class => 'thumbnail', :id => photo.id, :style => bg_color)
              %br/
    .modal-footer
      %input.btn.btn-primary{:name => "commit", :type => "submit", :value => "Set As Profile Picture"}/

什么可能是错的,或者......不存在HAML的任何调试器? 感谢

1 个答案:

答案 0 :(得分:1)

我认为这可能是围绕三元声明的括号。这只是猜测,但其余部分似乎完全可以接受。