BACKTRACE

(condense)

Back to Posts List

GET

List all Controllers and actions

OUTDATED

<span class="ident">controllers</span> <span class="punct">=</span> <span class="constant">Dir</span><span class="punct">.</span><span class="ident">new</span><span class="punct">("</span><span class="string"><span class="expr">#{RAILS_ROOT}</span>/app/controllers</span><span class="punct">").</span><span class="ident">entries</span><br /><span class="ident">controllers</span><span class="punct">.</span><span class="ident">each</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">controller</span><span class="punct">|</span><br /><span class="keyword">if</span> <span class="ident">controller</span> <span class="punct">=~</span> <span class="punct">/</span><span class="regex">_controller</span><span class="punct">/</span><br /> <span class="ident">cont</span> <span class="punct">=</span> <span class="ident">controller</span><span class="punct">.</span><span class="ident">camelize</span><span class="punct">.</span><span class="ident">gsub</span><span class="punct">("</span><span class="string">.rb</span><span class="punct">","</span><span class="string"></span><span class="punct">")</span><br /> <span class="ident">puts</span> <span class="ident">cont</span><br /> <span class="punct">(</span><span class="ident">eval</span><span class="punct">("</span><span class="string"><span class="expr">#{cont}</span>.new.methods</span><span class="punct">")</span> <span class="punct">-</span><br />   <span class="constant">ApplicationController</span><span class="punct">.</span><span class="ident">methods</span> <span class="punct">-</span><br />   <span class="constant">Object</span><span class="punct">.</span><span class="ident">methods</span> <span class="punct">-</span> <br />   <span class="constant">ApplicationController</span><span class="punct">.</span><span class="ident">new</span><span class="punct">.</span><span class="ident">methods</span><span class="punct">).</span><span class="ident">sort</span><span class="punct">.</span><span class="ident">each</span> <span class="punct">{|</span><span class="ident">met</span><span class="punct">|</span><br />      <span class="ident">puts</span> <span class="punct">"</span><span class="string"><span class="escape">\t</span><span class="expr">#{met}</span></span><span class="punct">"</span><br />   <span class="punct">}</span><br /><span class="keyword">end</span><br /><br /><span class="keyword">end</span><br />

POST

blog comments powered by Disqus

I Don't have cookies.

ELAD ENV

Variable Value
LINKEDIN
TWITTER
FACEBOOK
GITHUB
WWR
IRC
{ 'irc.freenode.net' => [ '#rubyonrails', '#railsbridge', '#ruby', '#mootools' ]}
SKYPE
eladmeidar

You're seeing this error because I think it is funny.