Strange error in development mode in 2.3.2 when streaming data

4 views
Skip to first unread message

Jeff

unread,
Mar 26, 2009, 10:22:59 AM3/26/09
to Ruby on Rails: Talk
I've recently upgraded to 2.3.2 from 2.2.2. We used to have code in
our controller that streamed data back to the browser in chunks, and
that no longer works in 2.3.2. It seems to be messing up the
dependency-loading mechanism. Here's a simplified version of the code:

# visitor.rb
class Visitor < ActiveRecord::Base
has_many :events
end

# event.rb
class Event < ActiveRecord::Base
belongs_to :visitor
end

# Now the interesting part...

class MyController < ActionController::Base

def index
render :status => 200, :layout => false,
:text => Proc.new { |response, output| output.write
Visitor.first.events.inspect }
end

The error we get is:

A copy of Admin::VisitorEventsController has been removed from the
module tree but is still active!

This only happens if we try to reference an ActiveRecord model within
the proc. We can't move our code out of the proc, because the whole
idea is that we'll be streaming data that's being dynamically
generated inside the proc.

Anybody else seen this?

Thanks
Jeff
Reply all
Reply to author
Forward
0 new messages