padrino-framework: link_to with block in slim doesn't seem to work

I am using slim as my template syntax and using a block with the link_to helper doesn’t work.

My test is like this:

== link_to("/") do
  span Hello

It doesn’t print anything.

I digged into the code and traced it back to SlimHandler.concat_to_template:

def concat_to_template(text="")
  self.output_buffer << text if is_type? && text
  nil
end

It doesn’t come from the condition, I commented it and it didn’t change anything.

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 28 (13 by maintainers)

Commits related to this issue

Most upvoted comments

@pencilcheck and @akiva

Not sure if you figured this out by now, but I was trying to do something like:

li
  = link_to channel.name, channel_path(channel) do
    figure
      img src="//placekitten.com/g/400/200"
    h3
      = channel.name
    p
      = channel.description

This didn’t work. This is because I’m trying to set the content of the link with the first argument of link_to, when of course the content of the block is doing that.

Once you remove that first argument: = link_to channel_path(channel) do it works!