diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-11 15:18:24 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-11 15:18:24 +0100 |
commit | a9eebde8561df5c7c34669587c9e25e8baeeeabb (patch) | |
tree | 27f1f2b8642f94db9d386cfb5866ffd471354f02 /actionpack/lib | |
parent | c1239e6509d27f88db2fc59189fd9a95333283e1 (diff) | |
parent | 02bbde4e78f958d5495c19d953aaec58bb8ef998 (diff) | |
download | rails-a9eebde8561df5c7c34669587c9e25e8baeeeabb.tar.gz rails-a9eebde8561df5c7c34669587c9e25e8baeeeabb.tar.bz2 rails-a9eebde8561df5c7c34669587c9e25e8baeeeabb.zip |
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/caching/fragments.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_controller/railtie.rb | 28 |
2 files changed, 27 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/caching/fragments.rb b/actionpack/lib/action_controller/caching/fragments.rb index 806e6a1750..00a7f034d3 100644 --- a/actionpack/lib/action_controller/caching/fragments.rb +++ b/actionpack/lib/action_controller/caching/fragments.rb @@ -36,8 +36,8 @@ module ActionController #:nodoc: def fragment_for(buffer, name = {}, options = nil, &block) #:nodoc: if perform_caching - if fragment_exist?(name,options) - buffer.concat(read_fragment(name, options).html_safe!) + if fragment_exist?(name, options) + buffer.safe_concat(read_fragment(name, options)) else pos = buffer.length block.call diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb index 6b94c32b2a..42257f9400 100644 --- a/actionpack/lib/action_controller/railtie.rb +++ b/actionpack/lib/action_controller/railtie.rb @@ -37,11 +37,33 @@ module ActionController ActionController::Base.view_paths = view_path if ActionController::Base.view_paths.blank? end + class MetalMiddlewareBuilder + def initialize(metals) + @metals = metals + end + + def new(app) + ActionDispatch::Cascade.new(@metals, app) + end + + def name + ActionDispatch::Cascade.name + end + alias_method :to_s, :name + end + initializer "action_controller.initialize_metal" do |app| - Rails::Rack::Metal.requested_metals = app.config.metals + metal_root = "#{Rails.root}/app/metal" + load_list = app.config.metals || Dir["#{metal_root}/**/*.rb"] + + metals = load_list.map { |metal| + metal = File.basename(metal.gsub("#{metal_root}/", ''), '.rb') + require_dependency metal + metal.camelize.constantize + }.compact - app.config.middleware.insert_before(:"ActionDispatch::ParamsParser", - Rails::Rack::Metal, :if => Rails::Rack::Metal.metals.any?) + middleware = MetalMiddlewareBuilder.new(metals) + app.config.middleware.insert_before(:"ActionDispatch::ParamsParser", middleware) end # # Prepare dispatcher callbacks and run 'prepare' callbacks |