0

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?

MrYoshiji
  • 54,334
  • 13
  • 124
  • 117
rctneil
  • 7,016
  • 10
  • 40
  • 83

1 Answers1

2

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
MrYoshiji
  • 54,334
  • 13
  • 124
  • 117
  • Perfect, I needed the equals but added the 'do' keyword at the end. Thanks! Will accept as answer when it lets me – rctneil May 29 '13 at 21:26
  • You're welcome @rctneil . Keep in mind that this `do &block` works also for `image_tag`, `button_to`, etc ;-) – MrYoshiji May 29 '13 at 21:29