diff options
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/deprecated.rb | 1 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal/helpers.rb | 12 | ||||
-rw-r--r-- | actionpack/lib/action_controller/railtie.rb | 9 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/stack.rb | 14 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 5 |
5 files changed, 33 insertions, 8 deletions
diff --git a/actionpack/lib/action_controller/deprecated.rb b/actionpack/lib/action_controller/deprecated.rb index 589061e77c..edc0e5b3fe 100644 --- a/actionpack/lib/action_controller/deprecated.rb +++ b/actionpack/lib/action_controller/deprecated.rb @@ -2,3 +2,4 @@ ActionController::AbstractRequest = ActionController::Request = ActionDispatch:: ActionController::AbstractResponse = ActionController::Response = ActionDispatch::Response ActionController::Routing = ActionDispatch::Routing ActionController::Routing::Routes = ActionDispatch::Routing::RouteSet.new +ActionController::UrlWriter = AbstractController::UrlFor diff --git a/actionpack/lib/action_controller/metal/helpers.rb b/actionpack/lib/action_controller/metal/helpers.rb index 0e3db86861..ef3b89db14 100644 --- a/actionpack/lib/action_controller/metal/helpers.rb +++ b/actionpack/lib/action_controller/metal/helpers.rb @@ -56,6 +56,18 @@ module ActionController end module ClassMethods + def helpers_dir + ActiveSupport::Deprecation.warn "ActionController::Base.helpers_dir is deprecated. " << + "Please use ActionController::Base.helpers_path (which returns an array)" + self.helpers_path + end + + def helpers_dir=(value) + ActiveSupport::Deprecation.warn "ActionController::Base.helpers_dir= is deprecated. " << + "Please use ActionController::Base.helpers_path= (which is an array)" + self.helpers_path = Array(value) + end + def inherited(klass) klass.class_eval { default_helper_module! unless name.blank? } super diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb index f15c012471..29a0a346ec 100644 --- a/actionpack/lib/action_controller/railtie.rb +++ b/actionpack/lib/action_controller/railtie.rb @@ -8,17 +8,16 @@ module ActionController require "action_controller/railties/subscriber" subscriber ActionController::Railties::Subscriber.new + initializer "action_controller.logger" do + ActionController::Base.logger ||= Rails.logger + end + initializer "action_controller.set_configs" do |app| app.config.action_controller.each do |k,v| ActionController::Base.send "#{k}=", v end end - # TODO: ActionController::Base.logger should delegate to its own config.logger - initializer "action_controller.logger" do - ActionController::Base.logger ||= Rails.logger - end - initializer "action_controller.initialize_framework_caches" do ActionController::Base.cache_store ||= RAILS_CACHE end diff --git a/actionpack/lib/action_dispatch/middleware/stack.rb b/actionpack/lib/action_dispatch/middleware/stack.rb index 0dc1d70e37..18a2922fa7 100644 --- a/actionpack/lib/action_dispatch/middleware/stack.rb +++ b/actionpack/lib/action_dispatch/middleware/stack.rb @@ -55,7 +55,11 @@ module ActionDispatch when Class klass == middleware else - klass == ActiveSupport::Inflector.constantize(middleware.to_s) + if lazy_compare?(@klass) && lazy_compare?(middleware) + normalize(@klass) == normalize(middleware) + else + klass == ActiveSupport::Inflector.constantize(middleware.to_s) + end end end @@ -72,6 +76,14 @@ module ActionDispatch end private + def lazy_compare?(object) + object.is_a?(String) || object.is_a?(Symbol) + end + + def normalize(object) + object.to_s.strip.sub(/^::/, '') + end + def build_args Array(args).map { |arg| arg.respond_to?(:call) ? arg.call : arg } end diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index fcbb70749f..5199984814 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -157,10 +157,11 @@ module ActionDispatch end # Invokes Rack::Mount::Utils.normalize path and ensure that - # (:locale) becomes (/:locale) instead of /(:locale). + # (:locale) becomes (/:locale) instead of /(:locale). Except + # for root cases, where the latter is the correct one. def self.normalize_path(path) path = Rack::Mount::Utils.normalize_path(path) - path.sub!(%r{/\(+/?:}, '(/:') + path.sub!(%r{/(\(+)/?:}, '\1/:') unless path =~ %r{^/\(+:.*\)$} path end |