Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 3 HAML-语法错误,意外的关键字_Ruby On Rails 3_Templates_View_Haml - Fatal编程技术网

Ruby on rails 3 HAML-语法错误,意外的关键字

Ruby on rails 3 HAML-语法错误,意外的关键字,ruby-on-rails-3,templates,view,haml,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"}/ 代码: 可能有什么问题,或者。。。HAML不存在任何调试器? 谢谢我想可能是十进制语句的括号。这只是一个猜

在下面的代码部分,我仍然会遇到以下错误:

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

可能有什么问题,或者。。。HAML不存在任何调试器?
谢谢

我想可能是十进制语句的括号。这只是一个猜测,但其余的我似乎完全可以接受。

是的,你是对的,三元运算符下的线必须向左移动2个空格
#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"}/