Apparently got fixed in Rails 2.3.3

Using Proc as a response you pass from the controller sometimes causes 500 error. It happens to be the nature of the Rack/Rails life cycle. Before response was sent/called before Dependencies cleanup in Rails, because it was part of the flow on request-response processing. Now with Rack in front of Rails, the Proc is not called in the request-response flow of the Rails, but in the Rack after Rails finished and if you happens to use Model classes inside the Proc, then you may get empty or partial response and some errors in Apache error logs

For example -

  • Exception NoMethodError on the instance of object you know this method exist
    *** Exception NoMethodError in application (undefined method `collect_money?' for #<MyObject:0x65bb610>) (process 18677
    ):
            from /opt/ror/main/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:255:in `method_missing'
            from /opt/ror/main/app/controllers/manage_object_controller.rb:767:in `prepare_export_list'
            from /opt/ror/main/app/controllers/manage_object_controller.rb:586:in `export'
            from /opt/ror/main/app/controllers/application_controller.rb:454:in `stream_csv'
            from /opt/ror/main/vendor/rails/actionpack/lib/action_controller/response.rb:154:in `call'
            from /opt/ror/main/vendor/rails/actionpack/lib/action_controller/response.rb:154:in `each'
            from /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/passenger-2.2.4/lib/phusion_passenger/rack/request_handler.rb:107:in `process_request'
    
    

Solution !?. Test Proc responses in production mode