From 04d4537cd40d0415d15af4395213632735c8683f Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Sun, 9 Aug 2009 07:14:24 -0300 Subject: [PATCH] This change causes some failing tests, but it should be possible to make them pass with minimal performance impact. --- actionpack/examples/minimal.rb | 6 +++-- .../lib/action_dispatch/http/request.rb | 23 ++++++++++--------- .../lib/action_view/template/resolver.rb | 6 +++-- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/actionpack/examples/minimal.rb b/actionpack/examples/minimal.rb index a9015da053..b3733b487b 100644 --- a/actionpack/examples/minimal.rb +++ b/actionpack/examples/minimal.rb @@ -91,6 +91,8 @@ class HttpPostController < ActionController::Metal end end +ActionController::Base.use_accept_header = false + unless ENV["PROFILE"] Runner.run(BasePostController.action(:overhead), N, 'overhead', false) Runner.run(BasePostController.action(:index), N, 'index', false) @@ -108,10 +110,10 @@ unless ENV["PROFILE"] Runner.run(BasePostController.action(:show_template), N, 'template') end else - Runner.run(BasePostController.action(:many_partials), N, 'many_partials') + Runner.run(BasePostController.action(ENV["PROFILE"].to_sym), N, ENV["PROFILE"]) require "ruby-prof" RubyProf.start - Runner.run(BasePostController.action(:many_partials), N, 'many_partials') + Runner.run(BasePostController.action(ENV["PROFILE"].to_sym), N, ENV["PROFILE"]) result = RubyProf.stop printer = RubyProf::CallStackPrinter.new(result) printer.print(File.open("output.html", "w")) diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index 4190fa21cd..958a541436 100755 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -176,17 +176,18 @@ module ActionDispatch # Expand raw_formats by converting Mime::ALL to the Mime::SET. # def formats - if ActionController::Base.use_accept_header - raw_formats.tap do |ret| - if ret == ONLY_ALL - ret.replace Mime::SET - elsif all = ret.index(Mime::ALL) - ret.delete_at(all) && ret.insert(all, *Mime::SET) - end - end - else - raw_formats + Mime::SET - end + return raw_formats + # if ActionController::Base.use_accept_header + # raw_formats.tap do |ret| + # if ret == ONLY_ALL + # ret.replace Mime::SET + # elsif all = ret.index(Mime::ALL) + # ret.delete_at(all) && ret.insert(all, *Mime::SET) + # end + # end + # else + # raw_formats + Mime::SET + # end end # Sets the \format by string extension, which can be used to force custom formats diff --git a/actionpack/lib/action_view/template/resolver.rb b/actionpack/lib/action_view/template/resolver.rb index ebfc6cc8ce..3bd2acae7a 100644 --- a/actionpack/lib/action_view/template/resolver.rb +++ b/actionpack/lib/action_view/template/resolver.rb @@ -41,8 +41,10 @@ module ActionView end def handler_glob - e = TemplateHandlers.extensions.map{|h| ".#{h},"}.join - "{#{e}}" + @handler_glob ||= begin + e = TemplateHandlers.extensions.map{|h| ".#{h},"}.join + "{#{e}}" + end end def formats_glob