From 635c1ca007a4e86f277508ec5b116ebcbe71a7f2 Mon Sep 17 00:00:00 2001 From: "Mr. Wolfe" Date: Wed, 10 Aug 2011 23:27:00 +0200 Subject: Revert "update rails on rack guide, section 2 needs to be changed or maybe deleted" This reverts commit 7a4e545eccf834cb620df0f909ef3f4bec4e6608. --- railties/guides/source/rails_on_rack.textile | 33 ++++++++++------------------ 1 file changed, 12 insertions(+), 21 deletions(-) (limited to 'railties/guides') diff --git a/railties/guides/source/rails_on_rack.textile b/railties/guides/source/rails_on_rack.textile index ea26334ba0..8d5985dba8 100644 --- a/railties/guides/source/rails_on_rack.textile +++ b/railties/guides/source/rails_on_rack.textile @@ -89,32 +89,23 @@ $ rake middleware For a freshly generated Rails application, this might produce something like: -use ActionDispatch::Static use Rack::Lock -use ActiveSupport::Cache::Strategy::LocalCache -use Rack::Runtime -use Rails::Rack::Logger -use ActionDispatch::ShowExceptions -use ActionDispatch::RemoteIp -use Rack::Sendfile -use ActionDispatch::Callbacks -use ActiveRecord::ConnectionAdapters::ConnectionManagement -use ActiveRecord::QueryCache -use ActionDispatch::Cookies -use ActionDispatch::Session::CookieStore -use ActionDispatch::Flash -use ActionDispatch::ParamsParser +use ActionController::Failsafe +use ActionController::Session::CookieStore, , {:secret=>"", :session_key=>"__session"} +use Rails::Rack::Metal +use ActionDispatch::RewindableInput +use ActionController::ParamsParser use Rack::MethodOverride -use ActionDispatch::Head -use ActionDispatch::BestStandardsSupport -run Blog::Application.routes +use Rack::Head +use ActiveRecord::QueryCache +run ActionController::Dispatcher.new Purpose of each of this middlewares is explained in the "Internal Middlewares":#internal-middleware-stack section. h4. Configuring Middleware Stack -Rails provides a simple configuration interface +config.middleware+ for adding, removing and modifying the middlewares in the middleware stack via +application.rb+ or the environment specific configuration file environments/<environment>.rb. +Rails provides a simple configuration interface +config.middleware+ for adding, removing and modifying the middlewares in the middleware stack via +environment.rb+ or the environment specific configuration file environments/<environment>.rb. h5. Adding a Middleware @@ -127,7 +118,7 @@ You can add a new middleware to the middleware stack using any of the following * config.middleware.insert_after(existing_middleware, new_middleware, args) - Adds the new middleware after the specified existing middleware in the middleware stack. -# config/application.rb +# config/environment.rb # Push Rack::BounceFavicon at the bottom config.middleware.use Rack::BounceFavicon @@ -142,7 +133,7 @@ h5. Swapping a Middleware You can swap an existing middleware in the middleware stack using +config.middleware.swap+. -# config/application.rb +# config/environment.rb # Replace ActionController::Failsafe with Lifo::Failsafe config.middleware.swap ActionController::Failsafe, Lifo::Failsafe @@ -207,7 +198,7 @@ The following shows how to replace use +Rack::Builder+ instead of the Rails supp Clear the existing Rails middleware stack -# application.rb +# environment.rb config.middleware.clear -- cgit v1.2.3