From 99b38f371a17eb3965f794227279e89fb6c694a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 16 May 2010 12:03:11 +0200 Subject: Move AD::Cascade to the bottom of the middleware stack. --- railties/lib/rails/application/configuration.rb | 4 +-- railties/lib/rails/configuration.rb | 31 +++++++++++++++++++++++ railties/lib/rails/railtie/configuration.rb | 33 +------------------------ 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index cd77f1adaf..9353fbefef 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -150,10 +150,10 @@ module Rails middleware.use('::ActionDispatch::Cookies') middleware.use(lambda { session_store }, lambda { session_options }) middleware.use('::ActionDispatch::Flash', :if => lambda { session_store }) - middleware.use(lambda { metal_loader.build_middleware(metals) }, :if => lambda { metal_loader.metals.any? }) - middleware.use('ActionDispatch::ParamsParser') + middleware.use('::ActionDispatch::ParamsParser') middleware.use('::Rack::MethodOverride') middleware.use('::ActionDispatch::Head') + middleware.use(lambda { metal_loader.build_middleware(metals) }, :if => lambda { metal_loader.metals.any? }) end end end diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index bd404f4a14..ee0fca6592 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -5,6 +5,37 @@ require 'rails/rack' module Rails module Configuration + class MiddlewareStackProxy #:nodoc: + def initialize + @operations = [] + end + + def insert_before(*args, &block) + @operations << [:insert_before, args, block] + end + + alias :insert :insert_before + + def insert_after(*args, &block) + @operations << [:insert_after, args, block] + end + + def swap(*args, &block) + @operations << [:swap, args, block] + end + + def use(*args, &block) + @operations << [:use, args, block] + end + + def merge_into(other) + @operations.each do |operation, args, block| + other.send(operation, *args, &block) + end + other + end + end + class Generators #:nodoc: attr_accessor :aliases, :options, :templates, :fallbacks, :colorize_logging diff --git a/railties/lib/rails/railtie/configuration.rb b/railties/lib/rails/railtie/configuration.rb index c4a315708b..4e6f94c534 100644 --- a/railties/lib/rails/railtie/configuration.rb +++ b/railties/lib/rails/railtie/configuration.rb @@ -3,37 +3,6 @@ require 'rails/configuration' module Rails class Railtie class Configuration - class MiddlewareStackProxy - def initialize - @operations = [] - end - - def insert_before(*args, &block) - @operations << [:insert_before, args, block] - end - - alias insert insert_before - - def insert_after(*args, &block) - @operations << [:insert_after, args, block] - end - - def swap(*args, &block) - @operations << [:swap, args, block] - end - - def use(*args, &block) - @operations << [:use, args, block] - end - - def merge_into(other) - @operations.each do |operation, args, block| - other.send(operation, *args, &block) - end - other - end - end - def initialize @@options ||= {} end @@ -44,7 +13,7 @@ module Rails # application once it is defined and the default_middlewares are # created def app_middleware - @@app_middleware ||= MiddlewareStackProxy.new + @@app_middleware ||= Rails::Configuration::MiddlewareStackProxy.new end # Holds generators configuration: -- cgit v1.2.3