<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -30,10 +30,8 @@ class ControllersDiagram &lt; AppDiagram
   def load_classes
     begin
       disable_stdout
-      # ApplicationController must be loaded first
-      require &quot;app/controllers/application_controller.rb&quot;
       files = Dir.glob(&quot;app/controllers/**/*_controller.rb&quot;) - @options.exclude
-      files.each {|c| require c }
+      files.each {|file| get_controller_class(file) }
       enable_stdout
     rescue LoadError
       enable_stdout
@@ -42,6 +40,22 @@ class ControllersDiagram &lt; AppDiagram
     end
   end # load_classes
 
+  # This method is taken from the annotate models gem
+  # http://github.com/ctran/annotate_models/tree/master
+  #
+  # Retrieve the classes belonging to the controller names we're asked to process
+  # Check for namespaced controllers in subdirectories as well as controllers
+  # in subdirectories without namespacing.
+  def get_controller_class(file)
+    model = file.sub(/^.*app\/controllers\//, '').sub(/\.rb$/, '').camelize
+    parts = model.split('::')
+    begin
+      parts.inject(Object) {|klass, part| klass.const_get(part) }
+    rescue LoadError
+      Object.const_get(parts.last)
+    end
+  end
+
   # Proccess a controller class
   def process_class(current_class)
 </diff>
      <filename>lib/railroad/controllers_diagram.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a8815fc3ba8df8db44d078dbf2046ddf99538120</id>
    </parent>
  </parents>
  <author>
    <name>Bruno Michel</name>
    <email>bmichel@menfin.info</email>
  </author>
  <url>http://github.com/ddollar/railroad/commit/96fb1c540dfc8e2300969e4778a7c7bff9563c59</url>
  <id>96fb1c540dfc8e2300969e4778a7c7bff9563c59</id>
  <committed-date>2009-03-13T07:12:57-07:00</committed-date>
  <authored-date>2009-03-13T07:12:57-07:00</authored-date>
  <message>Use autoload insted of require for controllers to avoid loading them twice</message>
  <tree>98528b9301f353062fe080d712a3ee7d4d7d32e3</tree>
  <committer>
    <name>Bruno Michel</name>
    <email>bmichel@menfin.info</email>
  </committer>
</commit>
