Hi all,
I’m trying to write a helper method which takes an argument and a block.
The markup returned should be a div, with a header (the title argument)
and the block string inside it (there will be other markup, for things
like rounded corners etc).
I’m getting confused about the behavior of the concat method, that I’ve
seen in some examples.
Currently, my helper method looks like this:
2 def render_box(title = ‘’, options = {}, &block)
3 content = capture(&block)
4 concat(content)
5 end
but for some reason, that returns a duplicate of my page markup, up
until the helper is called (see here: http://pastebin.com/Sx63zww8)
Can anybody explain what’s going on with concat? I would expect it
simply takes two arguments and returns the joined string, but it looks
as though it’s interfering with rails’ own output buffer.
tl;dr I basically want to pass a block to a helper and return something
like:
Thanks very much for reading.