Ticket #350 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

Consecutive form_for partial rendering loses form tags

Reported by: yere..@gmail.com Assigned to:
Priority: medium Milestone: The Future
Component: Plugins Keywords: form helpers
Cc:

Description

If using form_for consecutively, the second (and following) form tag is lost but the contents of the second form remain.

For example, given index.html.erb

<%= partial("one") %>
<%= partial("two") %>

and _one.html.erb

<% form_for(:obj, :action => "/one") do %>
	<%= text_control :a %>
<% end %>

and _two.html.erb

<% form_for(:obj, :action => "/two") do %>
	<%= text_control :b %>
<% end %>

This is rendered into

<form method="post" action="/one">
	<input type="text" name="nil_class[a]" value="" id="nil_class_a"/>
</form>
	<input type="text" name="nil_class[b]" value="" id="nil_class_b"/>

Since I couldn't find anything in merb that operates like form_for's merb form helpers, I'm assuming this is a merb form helper ticket.

I did find that explicitly niling the @_buffer first thing into a partial corrects the rendering.

Attachments

render_buffer_spec.diff (0.9 kB) - added by yere..@gmail.com on 12/10/07 06:04:48.
I think this will provide the failing spec
render_buffer.diff (0.9 kB) - added by yere..@gmail.com on 12/10/07 08:40:22.
Patch to not cache _buffer

Change History

12/10/07 05:09:30 changed by has.s..@gmail.com

I think this has to do with caching the @_buffer in the erubis_mixin and also in the haml template.

I will try to write a spec for this to test it, but I won't get to it for a bit. If you feel inclined to write a failing spec for this that would be great.

12/10/07 06:04:48 changed by yere..@gmail.com

  • attachment render_buffer_spec.diff added.

I think this will provide the failing spec

12/10/07 06:18:43 changed by yere..@gmail.com

By the way, your suspicion is correct. Removing the from the @_buffer assignment resolves the issue. Shall I submit a patch?

12/10/07 08:40:22 changed by yere..@gmail.com

  • attachment render_buffer.diff added.

Patch to not cache _buffer

12/10/07 15:13:27 changed by e.@brainspl.at

  • status changed from new to closed.
  • resolution set to fixed.

(In [1078]) fix caching of @_buffer in render, form_for closes #350, thanks yerejm