Erubis block helper throwing error with concat

Posted by DEfusion on Stack Overflow See other posts from Stack Overflow or by DEfusion
Published on 2009-12-04T23:40:56Z Indexed on 2010/03/27 19:23 UTC
Read the original article Hit count: 264

I have a couple of block helpers, here's a simple example of what I'm doing:

def wrap_foo foo, &block
    data = capture(&block)

    content = "
      <div class=\"foo\" id=\"#{foo}\">
        #{data}
      </div>"
    concat( content )
end

I'm just trying out erubis and it's giving me the following error:

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.<<

Removing the call to concat removes the error but ends up with my wrapper not being rendered

Using:

  • Rails 2.3.5
  • Erubis 2.6.5
  • And tried this gem that helps Erubis (though 2.6.4) and Rails 2.3 play better together

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about erubis