This project is archived and is in readonly mode.
fields_for not working outside ERB
Reported by Ryan Bates | April 10th, 2010 @ 06:31 PM | in 3.0.2
If one calls fields_for
in a helper method, then
the block result is not returned by the method. For example.
# application_helper.rb
def foobar
fields_for(:object, Object.new) do |f|
"foobar"
end
end
Calling <%= foobar %>
in the view will not
output "foobar" in Rails 3 Beta 2 but it will in Rails 2. This
breaks some nested form solutions.
I'll look into submitting a patch, but I think changing
with_output_buffer
to capture
in the
fields_for
method will do the job.
Comments and changes to this ticket
-
José Valim April 11th, 2010 @ 10:39 PM
- Assigned user set to José Valim
- Milestone cleared.
-
José Valim April 12th, 2010 @ 08:35 AM
- Assigned user changed from José Valim to Yehuda Katz (wycats)
Yehuda already applied.
-
Yehuda Katz (wycats) April 13th, 2010 @ 05:14 AM
- State changed from new to resolved
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>