aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHrvoje Šimić <shime.ferovac@gmail.com>2012-04-04 12:09:10 +0200
committerHrvoje Šimić <shime.ferovac@gmail.com>2012-04-04 12:09:10 +0200
commitf7a1c64ac3b487df8834eff0863a56fa10c18b97 (patch)
treef8a4e2a65b53ebb27ddb510a7902221846838c62
parentd4fa512defb380e724eec4c9d0157964dc11b71e (diff)
downloadrails-f7a1c64ac3b487df8834eff0863a56fa10c18b97.tar.gz
rails-f7a1c64ac3b487df8834eff0863a56fa10c18b97.tar.bz2
rails-f7a1c64ac3b487df8834eff0863a56fa10c18b97.zip
removed deprecated methods and middlewares
-rw-r--r--guides/source/rails_on_rack.textile64
1 files changed, 34 insertions, 30 deletions
diff --git a/guides/source/rails_on_rack.textile b/guides/source/rails_on_rack.textile
index 73e0f242cc..34dfd3572a 100644
--- a/guides/source/rails_on_rack.textile
+++ b/guides/source/rails_on_rack.textile
@@ -148,20 +148,50 @@ You can swap an existing middleware in the middleware stack using +config.middle
<ruby>
# config/application.rb
-# Replace ActionController::Failsafe with Lifo::Failsafe
-config.middleware.swap ActionController::Failsafe, Lifo::Failsafe
+# Replace ActionDispatch::ShowExceptions with Lifo::ShowExceptions
+config.middleware.swap ActionDispatch::ShowExceptions, Lifo::ShowExceptions
</ruby>
h5. Middleware Stack is an Array
The middleware stack behaves just like a normal +Array+. You can use any +Array+ methods to insert, reorder, or remove items from the stack. Methods described in the section above are just convenience methods.
-For example, the following removes the middleware matching the supplied class name:
+Append following lines to your application configuration:
<ruby>
-config.middleware.delete(middleware)
+# config/application.rb
+ config.middleware.delete "Rack::Lock"
+ config.middleware.delete "ActionDispatch::Cookies"
+ config.middleware.delete "ActionDispatch::Flash"
+ config.middleware.delete "ActionDispatch::RemoteIp"
+ config.middleware.delete "ActionDispatch::Reloader"
+ config.middleware.delete "ActionDispatch::Callbacks"
</ruby>
+And now inspecting the middleware stack:
+
+<shell>
+$ rake middleware
+(in /Users/lifo/Rails/blog)
+use ActionDispatch::Static
+use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x00000001c304c8>
+use Rack::Runtime
+use Rack::MethodOverride
+use ActionDispatch::RequestId
+use Rails::Rack::Logger
+use ActionDispatch::ShowExceptions
+use ActionDispatch::DebugExceptions
+use ActiveRecord::ConnectionAdapters::ConnectionManagement
+use ActiveRecord::QueryCache
+use ActionDispatch::Session::CookieStore
+use ActionDispatch::ParamsParser
+use ActionDispatch::Head
+use Rack::ConditionalGet
+use Rack::ETag
+use ActionDispatch::BestStandardsSupport
+run Myapp::Application.routes
+</shell>
+
h4. Internal Middleware Stack
Much of Action Controller's functionality is implemented as Middlewares. The following list explains the purpose of each of them:
@@ -234,32 +264,6 @@ Much of Action Controller's functionality is implemented as Middlewares. The fol
TIP: It's possible to use any of the above middlewares in your custom Rack stack.
-h4. Customizing Internal Middleware Stack
-
-It's possible to replace the entire middleware stack with a custom stack using <tt>ActionController::Dispatcher.middleware=</tt>.
-
-Put the following in an initializer:
-
-<ruby>
-# config/initializers/stack.rb
-ActionController::Dispatcher.middleware = ActionController::MiddlewareStack.new do |m|
- m.use ActionController::Failsafe
- m.use ActiveRecord::QueryCache
- m.use Rack::Head
-end
-</ruby>
-
-And now inspecting the middleware stack:
-
-<shell>
-$ rake middleware
-(in /Users/lifo/Rails/blog)
-use ActionController::Failsafe
-use ActiveRecord::QueryCache
-use Rack::Head
-run ActionController::Dispatcher.new
-</shell>
-
h4. Using Rack Builder
The following shows how to replace use +Rack::Builder+ instead of the Rails supplied +MiddlewareStack+.