From c8c95fc519f9d0e23e012d4434e6c3fe0f6e2a62 Mon Sep 17 00:00:00 2001
From: Ryan Bigg <radarlistener@gmail.com>
Date: Sat, 27 Nov 2010 08:29:29 +1100
Subject: Add methods for configuring middleware to config guide

---
 railties/guides/source/configuring.textile | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

(limited to 'railties/guides/source/configuring.textile')

diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile
index 8187c647dd..ca78cc0e6d 100644
--- a/railties/guides/source/configuring.textile
+++ b/railties/guides/source/configuring.textile
@@ -132,6 +132,29 @@ Every Rails application comes with a standard set of middleware which it uses in
 * +ActionDispatch::Head+ converts HEAD requests to GET requests and serves them as so.
 * +ActionDispatch::BestStandardsSupport+ enables "best standards support" so that IE8 renders some elements correctly.
 
+Besides these usual middleware, you can add your own by using the +config.middleware.use+ method:
+
+<ruby>
+  config.middleware.use Magical::Unicorns
+</ruby>
+
+This will put the +Magical::Unicorns+ middleware on the end of the stack. If you wish to put this middleware before another use +insert_before+:
+
+<ruby>
+  config.middleware.insert_before ActionDispatch::Head, Magical::Unicorns
+</ruby>
+
+There's also +insert_after+ which will insert a middleware _after_ another:
+
+<ruby>
+  config.middleware.insert_after ActionDispatch::Head, Magical::Unicorns
+</ruby>
+
+Middlewares can also be completely swapped out and replaced with others:
+
+<ruby>
+  config.middleware.swap ActionDispatch::BestStandardsSupport, Magical::Unicorns
+</ruby>
 
 h4. Configuring i18n
 
-- 
cgit v1.2.3

