<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Rubynaut: Rails: find controller for a path</title>
    <link>http://www.rubynaut.net/articles/2008/04/06/rails-find-controller-for-a-path</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Rails: find controller for a path</title>
      <description>&lt;p&gt;Huh, seems simple to do :p, but I&amp;#8217;ve been seeking for a while to find the answer and dig into rails code to find a simple method to retrieve the controller of a given path (could be useful to build a navigation). There it is:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="constant"&gt;ActionController&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Routing&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Routes&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;recognize_path&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;path&lt;/span&gt;&lt;span class="punct"&gt;)[&lt;/span&gt;&lt;span class="symbol"&gt;:controller&lt;/span&gt;&lt;span class="punct"&gt;]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
      <pubDate>Sun, 06 Apr 2008 14:20:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:c3f1bc7a-6a43-4750-a03c-c9ec03c8f625</guid>
      <author>stephane</author>
      <link>http://www.rubynaut.net/articles/2008/04/06/rails-find-controller-for-a-path</link>
    </item>
  </channel>
</rss>
