Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10814 (closed enhancement: fixed)

Opened 4 months ago

Last modified 4 months ago

[PATCH] Allow passing a FormBuilder to render :partial

Reported by: djanowski Assigned to: core
Priority: normal Milestone: 2.x
Component: ActionPack Version: edge
Severity: normal Keywords: partials form_builder
Cc:

Description

For DRYness and brevity, the proposed patch allows:

<% form_for(:person) do |f| %>

  <%= render :partial => f %>

<% end %>

This will render the people/_form partial with a local variable called form.

If given a different form builder:

<% form_for(:person, :builder => LabellingFormBuilder) do |f| %>

  <%= render :partial => f %>

<% end %>

The rendered template is people/_labelled_form and the local variable is also called labelled_form.

Patch and tests attached.

Attachments

render_partial_builder.diff (4.5 kB) - added by djanowski on 01/16/08 01:50:10.

Change History

01/15/08 23:23:10 changed by djanowski

Docs added.

01/16/08 01:50:10 changed by djanowski

  • attachment render_partial_builder.diff added.

01/16/08 01:51:02 changed by djanowski

More docs and better tests as per DefV's suggestions.

01/16/08 02:02:00 changed by nzkoz

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

(In [8646]) Make render :partial recognise form builders and use the _form partial. Closes #10814 [djanowski]