title: rails 4: split routes.rb into multiple smaller files
body: <p>I would like to split my routes in rails 4 application. For rails 3 the question has been answered a few times like:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/8907398/how-to-split-routes-rb-into-smaller-files">How to split routes.rb into smaller files</a></li>
  <li><a href="https://stackoverflow.com/questions/7303660/splitting-routes-file-into-multiple-files">Splitting Routes File Into Multiple Files</a></li>
  </ul>
  
  <p><strong><em>What would be the correct way to do this in rails 4 + how to get control over the order the routes get loaded?</em></strong></p>
  
  <p>Suggested from the rails 3 questions:</p>
  
  <p><strong>application.rb</strong></p>
  
  <pre><code>    config.paths['config/routes'] = Dir["config/routes/*.rb"]
  </code></pre>
  
  <p>Fails with:</p>
  
  <blockquote>
    <p>/Users/jordan/.rvm/gems/ruby-2.0.0-head@books/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:10:in
    `rescue in execute_if_updated':
    Rails::Application::RoutesReloader#execute_if_updated delegated to
    updater.execute_if_updated, but updater is nil:</p>
    
    
    
    <p>@route_sets=[#]>
    (RuntimeError)</p>
  </blockquote>