<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -200,9 +200,11 @@ module ActionController
           end
       end
 
-      attr_accessor :routes, :named_routes, :configuration_file
+      attr_accessor :routes, :named_routes, :configuration_files
 
       def initialize
+        self.configuration_files = []
+
         self.routes = []
         self.named_routes = NamedRouteCollection.new
 
@@ -216,7 +218,6 @@ module ActionController
       end
 
       def draw
-        clear!
         yield Mapper.new(self)
         install_helpers
       end
@@ -240,8 +241,22 @@ module ActionController
         routes.empty?
       end
 
+      def add_configuration_file(path)
+        self.configuration_files &lt;&lt; path
+      end
+
+      # Deprecated accessor
+      def configuration_file=(path)
+        add_configuration_file(path)
+      end
+      
+      # Deprecated accessor
+      def configuration_file
+        configuration_files
+      end
+
       def load!
-        Routing.use_controllers! nil # Clear the controller cache so we may discover new ones
+        Routing.use_controllers!(nil) # Clear the controller cache so we may discover new ones
         clear!
         load_routes!
       end
@@ -250,24 +265,39 @@ module ActionController
       alias reload! load!
 
       def reload
-        if @routes_last_modified &amp;&amp; configuration_file
-          mtime = File.stat(configuration_file).mtime
-          # if it hasn't been changed, then just return
-          return if mtime == @routes_last_modified
-          # if it has changed then record the new time and fall to the load! below
-          @routes_last_modified = mtime
+        if configuration_files.any? &amp;&amp; @routes_last_modified
+          if routes_changed_at == @routes_last_modified
+            return # routes didn't change, don't reload
+          else
+            @routes_last_modified = routes_changed_at
+          end
         end
+
         load!
       end
 
       def load_routes!
-        if configuration_file
-          load configuration_file
-          @routes_last_modified = File.stat(configuration_file).mtime
+        if configuration_files.any?
+          configuration_files.each { |config| load(config) }
+          @routes_last_modified = routes_changed_at
         else
           add_route &quot;:controller/:action/:id&quot;
         end
       end
+      
+      def routes_changed_at
+        routes_changed_at = nil
+        
+        configuration_files.each do |config|
+          config_changed_at = File.stat(config).mtime
+
+          if routes_changed_at.nil? || config_changed_at &gt; routes_changed_at
+            routes_changed_at = config_changed_at 
+          end
+        end
+        
+        routes_changed_at
+      end
 
       def add_route(path, options = {})
         route = builder.build(path, options)</diff>
      <filename>actionpack/lib/action_controller/routing/route_set.rb</filename>
    </modified>
    <modified>
      <diff>@@ -747,12 +747,16 @@ uses_mocha 'LegacyRouteSet, Route, RouteSet and RouteLoading' do
       ActionController::Base.optimise_named_routes = true
 
       @rs = ::ActionController::Routing::RouteSet.new
-      @rs.draw {|m| m.connect ':controller/:action/:id' }
 
       ActionController::Routing.use_controllers! %w(content admin/user admin/news_feed)
     end
+    
+    def teardown
+      @rs.clear!
+    end
 
     def test_default_setup
+      @rs.draw {|m| m.connect ':controller/:action/:id' }
       assert_equal({:controller =&gt; &quot;content&quot;, :action =&gt; 'index'}, rs.recognize_path(&quot;/content&quot;))
       assert_equal({:controller =&gt; &quot;content&quot;, :action =&gt; 'list'}, rs.recognize_path(&quot;/content/list&quot;))
       assert_equal({:controller =&gt; &quot;content&quot;, :action =&gt; 'show', :id =&gt; '10'}, rs.recognize_path(&quot;/content/show/10&quot;))
@@ -769,6 +773,7 @@ uses_mocha 'LegacyRouteSet, Route, RouteSet and RouteLoading' do
     end
 
     def test_ignores_leading_slash
+      @rs.clear!
       @rs.draw {|m| m.connect '/:controller/:action/:id'}
       test_default_setup
     end
@@ -1002,6 +1007,8 @@ uses_mocha 'LegacyRouteSet, Route, RouteSet and RouteLoading' do
     end
 
     def test_changing_controller
+      @rs.draw {|m| m.connect ':controller/:action/:id' }
+
       assert_equal '/admin/stuff/show/10', rs.generate(
         {:controller =&gt; 'stuff', :action =&gt; 'show', :id =&gt; 10},
         {:controller =&gt; 'admin/user', :action =&gt; 'index'}
@@ -1155,10 +1162,12 @@ uses_mocha 'LegacyRouteSet, Route, RouteSet and RouteLoading' do
     end
 
     def test_action_expiry
+      @rs.draw {|m| m.connect ':controller/:action/:id' }
       assert_equal '/content', rs.generate({:controller =&gt; 'content'}, {:controller =&gt; 'content', :action =&gt; 'show'})
     end
 
     def test_recognition_with_uppercase_controller_name
+      @rs.draw {|m| m.connect ':controller/:action/:id' }
       assert_equal({:controller =&gt; &quot;content&quot;, :action =&gt; 'index'}, rs.recognize_path(&quot;/Content&quot;))
       assert_equal({:controller =&gt; &quot;content&quot;, :action =&gt; 'list'}, rs.recognize_path(&quot;/ConTent/list&quot;))
       assert_equal({:controller =&gt; &quot;content&quot;, :action =&gt; 'show', :id =&gt; '10'}, rs.recognize_path(&quot;/CONTENT/show/10&quot;))
@@ -2399,13 +2408,13 @@ uses_mocha 'LegacyRouteSet, Route, RouteSet and RouteLoading' do
     def setup
       routes.instance_variable_set '@routes_last_modified', nil
       silence_warnings { Object.const_set :RAILS_ROOT, '.' }
-      ActionController::Routing::Routes.configuration_file = File.join(RAILS_ROOT, 'config', 'routes.rb')
+      routes.add_configuration_file(File.join(RAILS_ROOT, 'config', 'routes.rb'))
 
       @stat = stub_everything
     end
 
     def teardown
-      ActionController::Routing::Routes.configuration_file = nil
+      ActionController::Routing::Routes.configuration_files.clear
       Object.send :remove_const, :RAILS_ROOT
     end
 
@@ -2448,12 +2457,24 @@ uses_mocha 'LegacyRouteSet, Route, RouteSet and RouteLoading' do
     end
 
     def test_load_with_configuration
-      routes.configuration_file = &quot;foobarbaz&quot;
+      routes.configuration_files.clear
+      routes.add_configuration_file(&quot;foobarbaz&quot;)
       File.expects(:stat).returns(@stat)
       routes.expects(:load).with(&quot;foobarbaz&quot;)
 
       routes.reload
     end
+    
+    def test_load_multiple_configurations
+      routes.add_configuration_file(&quot;engines.rb&quot;)
+      
+      File.expects(:stat).at_least_once.returns(@stat)
+
+      routes.expects(:load).with('./config/routes.rb')
+      routes.expects(:load).with('engines.rb')
+
+      routes.reload
+    end
 
     private
       def routes</diff>
      <filename>actionpack/test/controller/routing_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>63d8f56774dcb1ea601928c3eb6c119d359fae10</id>
    </parent>
  </parents>
  <author>
    <name>David Heinemeier Hansson</name>
    <login>dhh</login>
    <email>david@loudthinking.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/40b40c487040d9c721d486e8ec8cfbc53a8cd79a</url>
  <id>40b40c487040d9c721d486e8ec8cfbc53a8cd79a</id>
  <committed-date>2008-11-26T06:57:36-08:00</committed-date>
  <authored-date>2008-11-26T06:57:36-08:00</authored-date>
  <message>Added support for multiple routes files and made draw not clear the map so they can be additive</message>
  <tree>942716155ba5aec22e70daff47498e4c3a7302c5</tree>
  <committer>
    <name>David Heinemeier Hansson</name>
    <login>dhh</login>
    <email>david@loudthinking.com</email>
  </committer>
</commit>
