This project is archived and is in readonly mode.
Regression in 3.0pre With content_for And Layouts
Reported by Ken Collins | August 24th, 2009 @ 12:53 AM | in 3.0.2
A recent commit in trunk for 3.0pre has caused a regression with content_for is used to insert content into a layout. Here is the commit for 9f5cd0156ab907d8097fc9c588823a9b09038b93.
http://github.com/rails/rails/commit/9f5cd0156ab907d8097fc9c588823a...
This is a very common practice and is documented in the code to work. In fact, it is even one of Ryan's early screen casts.
Comments and changes to this ticket
-
Ken Collins August 24th, 2009 @ 12:56 AM
Here is the patch that includes a passing test before the 9f5cd0 commit. It is still failing the inner template part however. Typically I am in ActiveRecord most of the time and I am not sure what needs to be done bring this to full parity with rails 2.3.4. There seems to much going on and I would appreciate feedback.
-
Michael Koziarski August 24th, 2009 @ 01:14 AM
- Milestone cleared.
-
Jeff Bigler February 16th, 2010 @ 07:25 AM
I've been able to duplicate this bug as well using 3.0beta edge. As a matter of fact, it doesn't even require using the content_for tag to see the error. After running a generator to create a simple Posts sample application, I set up a single line layouts/application.html.erb file:
<%= yield %>
I then created a layouts/posts.html.erb file with only the single line:
<% render :file => 'layouts/application' %>
and it fails with the LocalJumpError message. The error raised is "no block given". If I delete the layouts/posts.html.erb file everything works fine.
-
Carson Baker February 16th, 2010 @ 11:10 PM
Same problem here. Using render :file and content_for/yield gives "No block given" error.
-
Yehuda Katz (wycats) February 24th, 2010 @ 07:22 AM
@Carson would you mind creating a patch with a failing test against master?
-
Jeff Bigler February 25th, 2010 @ 04:09 AM
This is my first attempt to help out with a patch, so I apologize if there are any problems. I tried creating a test case for ActionPack that demonstrates the failure.
-
Jeff Bigler February 26th, 2010 @ 06:05 AM
This appears to be a duplicate of ticket #3459
The patch provided in that ticket fixed the problem.
-
Santiago Pastorino March 4th, 2010 @ 08:52 PM
- State changed from new to duplicate
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to
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>