<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -536,9 +536,7 @@ Run `rake gems:install` to install the missing gems.
     end
 
     def initialize_metal
-      Dir[&quot;#{configuration.root_path}/app/metal/*.rb&quot;].each do |file|
-        configuration.middleware.use(File.basename(file, '.rb').camelize)
-      end
+      configuration.middleware.use Rails::Rack::Metal
     end
 
     # Initializes framework-specific settings for each of the loaded frameworks</diff>
      <filename>railties/lib/initializer.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,21 +1,17 @@
 module Rails
   module Rack
     class Metal
+      def self.new(app)
+        apps = Dir[&quot;#{Rails.root}/app/metal/*.rb&quot;].map do |file|
+          File.basename(file, '.rb').camelize.constantize
+        end
+        apps &lt;&lt; app
+        ::Rack::Cascade.new(apps)
+      end
+
       NotFound = lambda { |env|
         [404, {&quot;Content-Type&quot; =&gt; &quot;text/html&quot;}, &quot;Not Found&quot;]
       }
-
-      def self.call(env)
-        new(NotFound).call(env)
-      end
-
-      def initialize(app)
-        @app = app
-      end
-
-      def call(env)
-        @app.call(env)
-      end
     end
   end
 end</diff>
      <filename>railties/lib/rails/rack/metal.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,12 @@
 # Allow the metal piece to run in isolation
 require(File.dirname(__FILE__) + &quot;/../../config/environment&quot;) unless defined?(Rails)
 
-class &lt;%= class_name %&gt; &lt; Rails::Rack::Metal
-  def call(env)
+class &lt;%= class_name %&gt;
+  def self.call(env)
     if env[&quot;PATH_INFO&quot;] =~ /^\/&lt;%= file_name %&gt;/
-      [200, {&quot;Content-Type&quot; =&gt; &quot;text/html&quot;}, &quot;Hello, World!&quot;]
+      [200, {&quot;Content-Type&quot; =&gt; &quot;text/html&quot;}, [&quot;Hello, World!&quot;]]
     else
-      super
+      [404, {&quot;Content-Type&quot; =&gt; &quot;text/html&quot;}, [&quot;Not Found&quot;]]
     end
   end
 end</diff>
      <filename>railties/lib/rails_generator/generators/components/metal/templates/metal.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>97a178bfa4d5101dca73ae931cc9c77385d8c97e</id>
    </parent>
  </parents>
  <author>
    <name>Joshua Peek</name>
    <login>josh</login>
    <email>josh@joshpeek.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/61a41154f7d50099da371e0d2f22fd25ab9113c2</url>
  <id>61a41154f7d50099da371e0d2f22fd25ab9113c2</id>
  <committed-date>2008-12-17T07:53:56-08:00</committed-date>
  <authored-date>2008-12-17T07:53:56-08:00</authored-date>
  <message>Make generated Metal bits a pure rack endpoint application (not middleware)

Instead of calling super to pass the request on, return a 404.
The modified app looks like this:

  # app/metal/poller.rb
  class Poller
    def self.call(env)
      if env[&quot;PATH_INFO&quot;] =~ /^\/poller/
        [200, {&quot;Content-Type&quot; =&gt; &quot;text/html&quot;}, &quot;Hello, World!&quot;]
      else
        [404, {&quot;Content-Type&quot; =&gt; &quot;text/html&quot;}, &quot;Not Found&quot;]
      end
    end
  end

But you aren't locked in to just Rails:

  # app/metal/api.rb
  require 'sinatra'
  Sinatra::Application.default_options.merge!(:run =&gt; false, :env =&gt; :production)
  Api = Sinatra.application unless defined? Api

  get '/interesting/new/ideas' do
    'Hello Sinatra!'
  end</message>
  <tree>257314af12fd4b66473752159b14e288af9864ee</tree>
  <committer>
    <name>Joshua Peek</name>
    <login>josh</login>
    <email>josh@joshpeek.com</email>
  </committer>
</commit>
