1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

update rails on rack guide, section 2 needs to be changed or maybe deleted

This commit is contained in:
Emili Parreño 2011-08-10 23:32:11 +02:00 committed by Xavier Noria
parent 635c1ca007
commit 1b0d03b5db

View file

@ -89,23 +89,32 @@ $ rake middleware
For a freshly generated Rails application, this might produce something like: For a freshly generated Rails application, this might produce something like:
<ruby> <ruby>
use ActionDispatch::Static
use Rack::Lock use Rack::Lock
use ActionController::Failsafe use ActiveSupport::Cache::Strategy::LocalCache
use ActionController::Session::CookieStore, , {:secret=>"<secret>", :session_key=>"_<app>_session"} use Rack::Runtime
use Rails::Rack::Metal use Rails::Rack::Logger
use ActionDispatch::RewindableInput use ActionDispatch::ShowExceptions
use ActionController::ParamsParser use ActionDispatch::RemoteIp
use Rack::MethodOverride use Rack::Sendfile
use Rack::Head use ActionDispatch::Callbacks
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache use ActiveRecord::QueryCache
run ActionController::Dispatcher.new use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use Rack::MethodOverride
use ActionDispatch::Head
use ActionDispatch::BestStandardsSupport
run Blog::Application.routes
</ruby> </ruby>
Purpose of each of this middlewares is explained in the "Internal Middlewares":#internal-middleware-stack section. Purpose of each of this middlewares is explained in the "Internal Middlewares":#internal-middleware-stack section.
h4. Configuring Middleware Stack h4. Configuring Middleware Stack
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 <tt>environments/&lt;environment&gt;.rb</tt>. 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 <tt>environments/&lt;environment&gt;.rb</tt>.
h5. Adding a Middleware h5. Adding a Middleware
@ -118,7 +127,7 @@ You can add a new middleware to the middleware stack using any of the following
* <tt>config.middleware.insert_after(existing_middleware, new_middleware, args)</tt> - Adds the new middleware after the specified existing middleware in the middleware stack. * <tt>config.middleware.insert_after(existing_middleware, new_middleware, args)</tt> - Adds the new middleware after the specified existing middleware in the middleware stack.
<ruby> <ruby>
# config/environment.rb # config/application.rb
# Push Rack::BounceFavicon at the bottom # Push Rack::BounceFavicon at the bottom
config.middleware.use Rack::BounceFavicon config.middleware.use Rack::BounceFavicon
@ -133,7 +142,7 @@ h5. Swapping a Middleware
You can swap an existing middleware in the middleware stack using +config.middleware.swap+. You can swap an existing middleware in the middleware stack using +config.middleware.swap+.
<ruby> <ruby>
# config/environment.rb # config/application.rb
# Replace ActionController::Failsafe with Lifo::Failsafe # Replace ActionController::Failsafe with Lifo::Failsafe
config.middleware.swap ActionController::Failsafe, Lifo::Failsafe config.middleware.swap ActionController::Failsafe, Lifo::Failsafe
@ -198,7 +207,7 @@ The following shows how to replace use +Rack::Builder+ instead of the Rails supp
<strong>Clear the existing Rails middleware stack</strong> <strong>Clear the existing Rails middleware stack</strong>
<ruby> <ruby>
# environment.rb # config/application.rb
config.middleware.clear config.middleware.clear
</ruby> </ruby>