aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-09-26 21:59:28 -0500
committerJoshua Peek <josh@joshpeek.com>2009-09-26 21:59:28 -0500
commita6757a02e12aa584bd74dbcde18a7886be8e9029 (patch)
tree74d3ca8fe45d1bc031371e7735241fa265e42c67 /actionpack/lib
parent14866fa3d83676d340d94464f50e2e0ea989c3c1 (diff)
downloadrails-a6757a02e12aa584bd74dbcde18a7886be8e9029.tar.gz
rails-a6757a02e12aa584bd74dbcde18a7886be8e9029.tar.bz2
rails-a6757a02e12aa584bd74dbcde18a7886be8e9029.zip
Move middleware and route configuration from AC::Dispatcher to Rails application object
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/dispatch/dispatcher.rb11
-rw-r--r--actionpack/lib/action_controller/testing/process.rb2
-rw-r--r--actionpack/lib/action_dispatch/testing/integration.rb5
3 files changed, 6 insertions, 12 deletions
diff --git a/actionpack/lib/action_controller/dispatch/dispatcher.rb b/actionpack/lib/action_controller/dispatch/dispatcher.rb
index 75b778a676..e04da42637 100644
--- a/actionpack/lib/action_controller/dispatch/dispatcher.rb
+++ b/actionpack/lib/action_controller/dispatch/dispatcher.rb
@@ -7,12 +7,6 @@ module ActionController
cattr_accessor :prepare_each_request
self.prepare_each_request = false
- cattr_accessor :router
- self.router = Routing::Routes
-
- cattr_accessor :middleware
- self.middleware = ActionDispatch::MiddlewareStack.new
-
class << self
def define_dispatcher_callbacks(cache_classes)
unless cache_classes
@@ -21,7 +15,7 @@ module ActionController
# Development mode callbacks
ActionDispatch::Callbacks.before_dispatch do |app|
- ActionController::Dispatcher.router.reload
+ ActionController::Routing::Routes.reload
end
ActionDispatch::Callbacks.after_dispatch do
@@ -55,7 +49,8 @@ module ActionController
:to => ActionDispatch::Callbacks
def new
- @@middleware.build(@@router)
+ # DEPRECATE Rails application fallback
+ Rails.application
end
end
end
diff --git a/actionpack/lib/action_controller/testing/process.rb b/actionpack/lib/action_controller/testing/process.rb
index fd368a7d79..bbc7f3c8f9 100644
--- a/actionpack/lib/action_controller/testing/process.rb
+++ b/actionpack/lib/action_controller/testing/process.rb
@@ -99,7 +99,6 @@ module ActionController #:nodoc:
temporary_routes = ActionController::Routing::RouteSet.new
ActionController::Routing.module_eval { const_set :Routes, temporary_routes }
- ActionController::Dispatcher.router = temporary_routes
yield temporary_routes
ensure
@@ -107,7 +106,6 @@ module ActionController #:nodoc:
ActionController::Routing.module_eval { remove_const :Routes }
end
ActionController::Routing.const_set(:Routes, real_routes) if real_routes
- ActionController::Dispatcher.router = ActionController::Routing::Routes
end
end
end
diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb
index f5dcea9158..9f7877fa46 100644
--- a/actionpack/lib/action_dispatch/testing/integration.rb
+++ b/actionpack/lib/action_dispatch/testing/integration.rb
@@ -484,8 +484,9 @@ module ActionDispatch
@@app = nil
def self.app
- # DEPRECATE AC::Dispatcher fallback
- @@app || ActionController::Dispatcher.new
+ # DEPRECATE Rails application fallback
+ # This should be set by the initializer
+ @@app || (defined?(Rails.application) && Rails.application) || nil
end
def self.app=(app)