# Blocks using concat do not work inside helper

**URL:** <https://www.ruby-forum.com/t/blocks-using-concat-do-not-work-inside-helper/110218>\
**Category:** Rails\
**Created:** [July 24, 2007, 11:32am UTC](https://www.ruby-forum.com/t/blocks-using-concat-do-not-work-inside-helper/110218 "2007-07-24T11:32:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![art](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8797f3/32.png) [@art](https://www.ruby-forum.com/u/art)\
**Post date:** [July 24, 2007, 11:32am UTC](https://www.ruby-forum.com/t/blocks-using-concat-do-not-work-inside-helper/110218/1 "2007-07-24T11:32:33Z")

</div>

Hi,

I wrote this ticket yesterday and it had been deleted and marked as  
invalid  
[http://dev.rubyonrails.org/ticket/9066](http://dev.rubyonrails.org/ticket/9066)

## Ticket:

When I try to do this from a helper:

def foo(&block)  
concat “

”, block.binding  
yield  
concat “
”, block.binding  
end

def bar(&block)  
concat foo {“content”}, block.binding  
yield  
end

I get this error

undefined local variable or method `\_erbout’ for …  
Using “foo” without “concat” works.

## def foo( &block) yield end

Nothing wrong with that but the solution postet by josh doesn’t help:  
def foo(&block)  
concat content\_tag(:div, capture(&block)), block.binding  
end

I get the same error.

---

<div class="post-metadata">

**Author:** ![art](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8797f3/32.png) [@art](https://www.ruby-forum.com/u/art)\
**Post date:** [September 22, 2008, 4:15pm UTC](https://www.ruby-forum.com/t/blocks-using-concat-do-not-work-inside-helper/110218/2 "2008-09-22T16:15:29Z")

</div>

Hi,

I am having the same problem too. I don’t understand how to use the  
concat method inside a helper. It works fine in the view though.
