rails/rails — pull request #3772 by lest (2011-11-27 14:16:50+00:00)
Title: fix label with block in erb

The following template code:

```
<%= label 'post', 'message' do %>
Message
<%= text_field 'post', 'message' %>
<% end %>
```

Generates:

```
Message

Message

```

It happens because of `InstanceTag#to_label_tag` invokes `capture` helper (through `label_tag` and `content_tag`) and `capture` helper can't capture output of block because block is in (ActionView::Base context) and `capture` helper executes in (InstanceTag context).

I've put call `label_tag` from `@template_object` when block is passed. Also `Helpers::CaptureHelper` and `Context` modules aren't longer needed in `InstanceTag`.

It could also could be reason for #3385

/cc @josevalim