aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-12-01 13:48:47 -0600
committerJoshua Peek <josh@joshpeek.com>2008-12-01 13:49:34 -0600
commit06ed8e451198b2296d8b2752741e259b4f995081 (patch)
tree9e7733152cb317178ea95bfbe423e98e252a98c3 /railties
parent3c07a8828ede3d41000513af29c293ae2e2a49d4 (diff)
downloadrails-06ed8e451198b2296d8b2752741e259b4f995081.tar.gz
rails-06ed8e451198b2296d8b2752741e259b4f995081.tar.bz2
rails-06ed8e451198b2296d8b2752741e259b4f995081.zip
Add internal middleware stack to Dispatcher
config.middleware.use Rack::Cache
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/initializer.rb5
-rw-r--r--railties/lib/tasks/middleware.rake7
2 files changed, 12 insertions, 0 deletions
diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb
index a134c68a50..4bb1e480b7 100644
--- a/railties/lib/initializer.rb
+++ b/railties/lib/initializer.rb
@@ -881,6 +881,11 @@ Run `rake gems:install` to install the missing gems.
end
end
+ def middleware
+ require 'action_controller'
+ ActionController::Dispatcher.middleware
+ end
+
def builtin_directories
# Include builtins only in the development environment.
(environment == 'development') ? Dir["#{RAILTIES_PATH}/builtin/*/"] : []
diff --git a/railties/lib/tasks/middleware.rake b/railties/lib/tasks/middleware.rake
new file mode 100644
index 0000000000..e0dcf50307
--- /dev/null
+++ b/railties/lib/tasks/middleware.rake
@@ -0,0 +1,7 @@
+desc 'Prints out your Rack middleware stack'
+task :middleware => :environment do
+ ActionController::Dispatcher.middleware.each do |middleware|
+ puts "use #{middleware.inspect}"
+ end
+ puts "run ActionController::Dispatcher.new"
+end