diff options
author | Mikel Lindsaar <raasdnil@gmail.com> | 2010-04-25 17:07:55 +1000 |
---|---|---|
committer | Mikel Lindsaar <raasdnil@gmail.com> | 2010-04-25 17:07:55 +1000 |
commit | e1b255aca456a5b456111b09237805fd32d15111 (patch) | |
tree | a87c8b8989449a9dbdf1c6897901f6957ec021dc /railties/guides/source/rails_on_rack.textile | |
parent | 60ab54113fa833a1258d687673561b9474964149 (diff) | |
parent | a5955196f2ed8a69c49a1a8c0c617ab91cb8d716 (diff) | |
download | rails-e1b255aca456a5b456111b09237805fd32d15111.tar.gz rails-e1b255aca456a5b456111b09237805fd32d15111.tar.bz2 rails-e1b255aca456a5b456111b09237805fd32d15111.zip |
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'railties/guides/source/rails_on_rack.textile')
-rw-r--r-- | railties/guides/source/rails_on_rack.textile | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/railties/guides/source/rails_on_rack.textile b/railties/guides/source/rails_on_rack.textile index d0d86e99f2..512be43668 100644 --- a/railties/guides/source/rails_on_rack.textile +++ b/railties/guides/source/rails_on_rack.textile @@ -247,7 +247,7 @@ class Poller if env["PATH_INFO"] =~ /^\/poller/ [200, {"Content-Type" => "text/html"}, ["Hello, World!"]] else - [404, {"Content-Type" => "text/html"}, ["Not Found"]] + [404, {"Content-Type" => "text/html", "X-Cascade" => "pass"}, ["Not Found"]] end end end @@ -257,23 +257,13 @@ Metal applications within +app/metal+ folders in plugins will also be discovered Metal applications are an optimization. You should make sure to "understand the related performance implications":http://weblog.rubyonrails.org/2008/12/20/performance-of-rails-metal before using it. -h4. Execution Order - -All Metal Applications are executed by +Rails::Rack::Metal+ middleware, which is a part of the +ActionController::MiddlewareStack+ chain. +WARNING: To continue the Metal chain execution, return an +X-Cascade+ HTTP header with a value of +pass+. -Here's the primary method responsible for running the Metal applications: +h4. Execution Order -<ruby> -def call(env) - @metals.keys.each do |app| - result = app.call(env) - return result unless result[0].to_i == 404 - end - @app.call(env) -end -</ruby> +All Metal Applications are executed in alphabetical order of their filenames, so +aaa.rb+ will come before +bbb.rb+ in the metal chain. -In the code above, +@metals+ is an ordered hash of metal applications. Due to the default alphabetical ordering, +aaa.rb+ will come before +bbb.rb+ in the metal chain. +You can override the default ordering in your environment. Simply add a line like the following to +config/application.rb+ It is, however, possible to override the default ordering in your environment. Simply add a line like the following to +config/environment.rb+ @@ -283,8 +273,6 @@ config.metals = ["Bbb", "Aaa"] Each string in the array should be the name of your metal class. If you do this then be warned that any metal applications not listed will not be loaded. -WARNING: Metal applications cannot return the HTTP Status +404+ to a client, as it is used for continuing the Metal chain execution. Please use normal Rails controllers or a custom middleware if returning +404+ is a requirement. - h3. Resources h4. Learning Rack |