aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides
diff options
context:
space:
mode:
authorwycats <wycats@gmail.com>2010-05-29 20:07:47 +0200
committerwycats <wycats@gmail.com>2010-05-29 20:08:00 +0200
commit45e60283e733a535d68d499aa20e095c905f43b0 (patch)
treeee2fbf07bfca011623c928c0b24a7783925e8f88 /railties/guides
parent564ab4776c7e54268dc60e9a3fced7ba37657c72 (diff)
downloadrails-45e60283e733a535d68d499aa20e095c905f43b0.tar.gz
rails-45e60283e733a535d68d499aa20e095c905f43b0.tar.bz2
rails-45e60283e733a535d68d499aa20e095c905f43b0.zip
Removing Metal from Rails 3.
If you have existing Metals, you have a few options: * if your metal behaves like a middleware, add it to the middleware stack via config.middleware.use. You can use methods on the middleware stack to control exactly where it should go * if it behaves like a Rack endpoint, you can link to it in the router. This will result in more optimal routing time, and allows you to remove code in your endpoint that matches specific URLs in favor of the more powerful handling in the router itself. For the future, you can use ActionController::Metal to get a very fast controller with the ability to opt-in to specific controller features without paying the penalty of the full controller stack. Since Rails 3 is closer to Rack, the Metal abstraction is no longer needed.
Diffstat (limited to 'railties/guides')
-rw-r--r--railties/guides/source/configuring.textile2
-rw-r--r--railties/guides/source/initialization.textile6
-rw-r--r--railties/guides/source/rails_on_rack.textile51
3 files changed, 1 insertions, 58 deletions
diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile
index bd2289890a..ab72b48034 100644
--- a/railties/guides/source/configuring.textile
+++ b/railties/guides/source/configuring.textile
@@ -63,8 +63,6 @@ h4. Rails General Configuration
* +config.logger+ accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then used to log information from Action Controller. Set to nil to disable logging.
-* +config.metals+ accepts an array used as the metals to load. If this is set to nil, all metals will be loaded in alphabetical order. If this is set to [], no metals will be loaded. Otherwise metals will be loaded in the order specified
-
* +config.plugin_loader+ overrides the class that handles loading each plugin. Defaults to +Rails::Plugin::Loader+.
* +config.plugin_locators+ overrides the class that handle finding the desired plugins that you‘d like to load for your application. By default it is the +Rails::Plugin::FileSystemLocator+.
diff --git a/railties/guides/source/initialization.textile b/railties/guides/source/initialization.textile
index cccbb9df06..58ae115ba7 100644
--- a/railties/guides/source/initialization.textile
+++ b/railties/guides/source/initialization.textile
@@ -668,7 +668,6 @@ This file requires _rails/railtie.rb_ which defines +Rails::Railtie+.
* add_routing_namespaces
* add_locales
* add_view_paths
-* add_metals
* add_generator_templates
* load_application_initializers
* load_application_classes
@@ -726,7 +725,6 @@ This file is used to set up the +Rails::Paths+ module which is used to set up he
paths.app.helpers "app/helpers", :eager_load => true
paths.app.models "app/models", :eager_load => true
paths.app.mailers "app/mailers", :eager_load => true
- paths.app.metals "app/metal", :eager_load => true
paths.app.views "app/views", :eager_load => true
paths.lib "lib", :load_path => true
paths.lib.tasks "lib/tasks", :glob => "**/*.rake"
@@ -3154,7 +3152,6 @@ This method is defined like this:
middleware.use('ActionDispatch::Cookies')
middleware.use(lambda { ActionController::Base.session_store }, lambda { ActionController::Base.session_options })
middleware.use('ActionDispatch::Flash', :if => lambda { ActionController::Base.session_store })
- middleware.use(lambda { Rails::Rack::Metal.new(Rails.application.config.paths.app.metals.to_a, Rails.application.config.metals) })
middleware.use('ActionDispatch::ParamsParser')
middleware.use('::Rack::MethodOverride')
middleware.use('::ActionDispatch::Head')
@@ -3288,7 +3285,7 @@ Finally, a +Rails::Application::Configuration+ object will be returned. On this
<ruby>
attr_accessor :after_initialize_blocks, :cache_classes, :colorize_logging,
:consider_all_requests_local, :dependency_loading,
- :load_once_paths, :logger, :metals, :plugins,
+ :load_once_paths, :logger, :plugins,
:preload_frameworks, :reload_plugins, :serve_static_assets,
:time_zone, :whiny_nils
@@ -3574,7 +3571,6 @@ The +super+ method it references comes from +Rails::Engine::Configuration+ which
paths.app.controllers "app/controllers", :eager_load => true
paths.app.helpers "app/helpers", :eager_load => true
paths.app.models "app/models", :eager_load => true
- paths.app.metals "app/metal"
paths.app.views "app/views"
paths.lib "lib", :load_path => true
paths.lib.tasks "lib/tasks", :glob => "**/*.rake"
diff --git a/railties/guides/source/rails_on_rack.textile b/railties/guides/source/rails_on_rack.textile
index 512be43668..eaebb05f17 100644
--- a/railties/guides/source/rails_on_rack.textile
+++ b/railties/guides/source/rails_on_rack.textile
@@ -222,57 +222,6 @@ use MyOwnStackFromStratch
run ActionController::Dispatcher.new
</ruby>
-h3. Rails Metal Applications
-
-Rails Metal applications are minimal Rack applications specially designed for integrating with a typical Rails application. As Rails Metal Applications skip all of the Action Controller stack, serving a request has no overhead from the Rails framework itself. This is especially useful for infrequent cases where the performance of the full stack Rails framework is an issue.
-
-Ryan Bates' "Railscast on Rails Metal":http://railscasts.com/episodes/150-rails-metal provides a nice walkthrough generating and using Rails Metal.
-
-h4. Generating a Metal Application
-
-Rails provides a generator called +metal+ for creating a new Metal application:
-
-<shell>
-$ rails generate metal poller
-</shell>
-
-This generates +poller.rb+ in the +app/metal+ directory:
-
-<ruby>
-# Allow the metal piece to run in isolation
-require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
-
-class Poller
- def self.call(env)
- if env["PATH_INFO"] =~ /^\/poller/
- [200, {"Content-Type" => "text/html"}, ["Hello, World!"]]
- else
- [404, {"Content-Type" => "text/html", "X-Cascade" => "pass"}, ["Not Found"]]
- end
- end
-end
-</ruby>
-
-Metal applications within +app/metal+ folders in plugins will also be discovered and added to the list.
-
-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.
-
-WARNING: To continue the Metal chain execution, return an +X-Cascade+ HTTP header with a value of +pass+.
-
-h4. Execution Order
-
-All Metal Applications are executed in alphabetical order of their filenames, so +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+
-
-<ruby>
-config.metals = ["Bbb", "Aaa"]
-</ruby>
-
-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.
-
h3. Resources
h4. Learning Rack