This project is archived and is in readonly mode.
render :text => Proc
Reported by Gareth Adams | April 23rd, 2009 @ 10:40 AM | in 3.x
As described at http://pastie.org/455603
Using render :text with a Proc causes unusual errors
class FoosController < ApplicationController
def bar
render :text => lambda { |response, output|
Foo.new.inspect
output.write "Blah"
}
end
end
Line 4 generates the error "Read error: #<ArgumentError: A copy of FoosController has been removed from the module tree but is still active!>". If I remove line 4, or place it outside the lambda, no error occurs and "Blah" is successfully output
Comments and changes to this ticket
-
Richard Fairhurst June 10th, 2009 @ 01:52 PM
I'm getting the same issue.
Also seems to be documented at:
http://groups.google.com/group/rubyonrails-core/browse_frm/thread/6...
http://groups.google.com/group/rubyonrails-talk/browse_thread/threa...
http://live.prokhorenko.us/2009/05/issues-with-ror-streaming-from.htmland to be 2.3.2-specific.
-
Rohit Arondekar June 23rd, 2010 @ 01:03 PM
Tried on Rails master.
I don't get any errors but this is what I get in the browser:
#<Proc:0x00000004d75b78@/home/rohit/bugmash/testapp/app/controllers/foos_controller.rb:3 (lambda)>
This is expected or should the output be "Blah"?
-
David Trasbo June 23rd, 2010 @ 01:13 PM
- Assigned user set to Ryan Bigg
I followed the steps describe in the Pastie using Rails 2.3.8 and it works beautifully.
I don't think
render :text
with aProc
is supposed to work in Rails 3 - it is not mentioned in the documentation. It probably simply callsto_s
on whatever is passed to it and outputs that.This ticket can be closed. If anyone wants this behavior back they can open a separate ticket with a patch.
-
Ryan Bigg June 23rd, 2010 @ 01:16 PM
- State changed from new to invalid
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>
People watching this ticket
Tags
Referenced by
- 2873 Application reloading should be deferred to end of request, currently interferes with 'render :text => lambda { ... }' streaming Another voice to say I'd be really pleased if this was fi...