苗条 - 意外的keyword_ensure,期待输入结束

时间:2013-05-29 21:13:57

标签: ruby-on-rails hyperlink slim-lang

我正在使用Slim获取我的观点,并且拥有:

/ = render 'alphabet'

div class="house-list" data-pjax-container="true"
  - @houses.each do |house|
    = link_to house_path(house)
      .picture
        = image_tag "http://mylink.com/150/#{house.name.to_s.parameterize}-#{house.location_1.to_s.parameterize}.jpg"
      .info
        h4 = house.name
        p = house.location_1

现在,这是导致问题的link_to行,如果我用普通div替换它就可以了但是使用link_to导致:

syntax error, unexpected keyword_ensure, expecting end-of-input

关于什么是错的任何想法?

1 个答案:

答案 0 :(得分:2)

我很确定在这种情况下您需要将do &block传递给此link_to

= link_to house_path(house) do
  .picture
    = image_tag "http://mylink.com/150/#{house.name.to_s.parameterize}-#{house.location_1.to_s.parameterize}.jpg"
  .info
    h4 = house.name
    p = house.location_1