rctneil
rctneil

Reputation: 7220

slim - unexpected keyword_ensure, expecting end-of-input

I'm using Slim for my views and have this:

/ = 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

Now, It's the link_to line causing issues, if I replace that with plain div it is all fine but using link_to causes:

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

Any ideas on what is wrong?

Upvotes: 0

Views: 2621

Answers (1)

MrYoshiji
MrYoshiji

Reputation: 54882

I'm pretty sure you need to pass a do &block to this link_to in this case:

= 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

Upvotes: 2

Related Questions