Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix label with block in erb #3772

Merged
merged 1 commit into from
Nov 27, 2011
Merged

fix label with block in erb #3772

merged 1 commit into from
Nov 27, 2011

Conversation

lest
Copy link
Contributor

@lest lest commented Nov 27, 2011

The following template code:

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

Generates:

  Message
  <input id="post_message" name="post[message]" size="30" type="text" />
<label for="post_message">
  Message
  <input id="post_message" name="post[message]" size="30" type="text" />
</label>

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

josevalim added a commit that referenced this pull request Nov 27, 2011
@josevalim josevalim merged commit ee8db25 into rails:master Nov 27, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants