语法错误,意外的keyword_else,期待keyword_end

时间:2015-03-06 03:00:31

标签: ruby-on-rails slim-lang

我正在使用SLIM,我不知道如何解决这个问题。我看到了这个错误:

  

语法错误/ users / user语法错误,意外的keyword_else,   期待keyword_end;其他;         ^ /views/users/shared/_user_item.html.slim:18:   语法错误,意外的keyword_ensure,期望输入结束

来自此档案:

li
  .common_box.box3
    .img_box
        = link_to user do
          - if user.avatar.present?
          img alt="" src="#{user.avatar.try(:image_url, :similar)}" style=("width: 194px;height: 139px;")  /
          - else
            img alt="no image" src="" style=("width: 194px;height: 139px;") /
    .img_detail
      small years
      .circle
        span.age_box = user.age 
      h3 #{user.username} #{current_user.location.state}
      h4 #{user.location.city}, #{user.location.state}
      .green_corner
        img alt="" src="/assets/side_curv.png" /

1 个答案:

答案 0 :(得分:1)

line 6上尝试此操作(您的图像标记没有缩进)。

li
  .common_box.box3
    .img_box
        = link_to user do
          - if user.avatar.present?
            img alt="" src="#{user.avatar.try(:image_url, :similar)}" style=("width: 194px;height: 139px;")  /
          - else
            img alt="no image" src="" style=("width: 194px;height: 139px;") /
    .img_detail
      small years
      .circle
        span.age_box = user.age 
      h3 #{user.username} #{current_user.location.state}
      h4 #{user.location.city}, #{user.location.state}
      .green_corner
        img alt="" src="/assets/side_curv.png" /
相关问题