title: Getting the full structure of a Rails app - from routes to controller to layouts and views
body: <p>My team is running a relatively large Rails setup which we intend to internationalize over the coming months. One of the first step we want to do is break down the work in more manageable units that we can keep track of.</p>
  
  <p>We're not yet sure what's the best granularity to target ('page' / controller / view) and we figured we should try to get a better picture of our app before diving into work. Rails ships with a way to show all the routes defined in the app and how they map to controllers and methods inside of these:</p>
  
  <p><code>bundle exec rake routes</code></p>
  
  <p>I'm wondering if there is a way to push this idea further and get a picture for how a given controller method maps to layouts / views / partials and so on. The Rails convention gives a high-level approximation of the rendering pipeline but it doesn't account for layouts and partials. Ideally, what I'd like is to draw the rendering tree for a a route:</p>
  
  <pre><code>GET /foos/:id {:controller=&gt;"foos", action=&gt;"show"}
      layout: views/layouts/application.haml
      partial: views/application/_header.haml
  </code></pre>