Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removed deprecated methods and middlewares

  • Loading branch information...
commit f7a1c64ac3b487df8834eff0863a56fa10c18b97 1 parent d4fa512
Hrvoje Šimić shime authored
Showing with 34 additions and 30 deletions.
  1. +34 −30 guides/source/rails_on_rack.textile
64 guides/source/rails_on_rack.textile
View
@@ -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+.
Please sign in to comment.
Something went wrong with that request. Please try again.