Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 1371

Show
Ignore:
Timestamp:
05/30/05 09:00:46 (3 years ago)
Author:
minam
Message:

Make sure the benchmarking render method always returns the result of the render, regardless of whether logging is enabled or not.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r1369 r1371  
    11*SVN* 
     2 
     3* Make sure the benchmarking render method always returns the output of the render. 
    24 
    35* render(:text), render(:partial), and render(:nothing) always default to :layout => false. This also fixes send_file, which was applying a layout if one existed for the current action. 
  • trunk/actionpack/lib/action_controller/benchmarking.rb

    r1350 r1371  
    2121      else 
    2222        db_runtime = ActiveRecord::Base.connection.reset_runtime if Object.const_defined?("ActiveRecord") && ActiveRecord::Base.connected? 
    23         @rendering_runtime = Benchmark::measure{ render_without_benchmark(options, deprecated_status) }.real 
     23 
     24        render_output = nil 
     25        @rendering_runtime = Benchmark::measure{ render_output = render_without_benchmark(options, deprecated_status) }.real 
    2426 
    2527        if Object.const_defined?("ActiveRecord") && ActiveRecord::Base.connected? 
     
    2830          @rendering_runtime -= @db_rt_after_render 
    2931        end 
     32 
     33        render_output 
    3034      end 
    3135    end     
  • trunk/actionpack/lib/action_controller/cgi_ext/raw_post_data_fix.rb

    r1283 r1371  
    1919 
    2020    private 
    21       MULTIPART_FORM_BOUNDARY_RE = %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|n #" 
     21      unless defined?(MULTIPART_FORM_BOUNDARY_RE) 
     22        MULTIPART_FORM_BOUNDARY_RE = %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|n #" 
     23      end 
    2224 
    2325      def multipart_form_boundary         
  • trunk/actionpack/test/controller/new_render_test.rb

    r1369 r1371  
    1010end 
    1111 
    12  
    13 class TestController < ActionController::Base 
     12class NewRenderTestController < ActionController::Base 
    1413  layout :determine_layout 
     14 
     15  def self.controller_name; "test"; end 
     16  def self.controller_path; "test"; end 
    1517 
    1618  def hello_world 
     
    104106end 
    105107 
    106 TestController.template_root = File.dirname(__FILE__) + "/../fixtures/" 
     108NewRenderTestController.template_root = File.dirname(__FILE__) + "/../fixtures/" 
    107109Fun::GamesController.template_root = File.dirname(__FILE__) + "/../fixtures/" 
    108110 
    109 class TestLayoutController < ActionController::Base 
    110   layout "layouts/standard" 
    111    
    112   def hello_world 
    113   end 
    114    
    115   def hello_world_outside_layout 
    116   end 
    117  
    118   def rescue_action(e) 
    119     raise unless ActionController::MissingTemplate === e 
    120   end 
    121 end 
    122  
    123 class RenderTest < Test::Unit::TestCase 
     111class NewRenderTest < Test::Unit::TestCase 
    124112  def setup 
    125     @controller = TestController.new 
     113    @controller = NewRenderTestController.new 
     114 
     115    # enable a logger so that (e.g.) the benchmarking stuff runs, so we can get 
     116    # a more accurate simulation of what happens in "real life". 
     117    @controller.logger = Logger.new(nil) 
     118 
    126119    @request    = ActionController::TestRequest.new 
    127120    @response   = ActionController::TestResponse.new 
     
    245238    assert_equal "Hello: David", @response.body 
    246239  end 
    247  
    248   private 
    249     def process_request 
    250       TestController.process(@request, @response) 
    251     end 
    252240end 
  • trunk/actionpack/test/controller/render_test.rb

    r1307 r1371  
    11require File.dirname(__FILE__) + '/../abstract_unit' 
    22 
    3 Customer = Struct.new("Customer", :name) 
     3unless defined?(Customer) 
     4  Customer = Struct.new("Customer", :name) 
     5end 
    46 
    57module Fun