controllers = Dir.new("#{RAILS_ROOT}/app/controllers").entries
controllers.each do |controller|
if controller =~ /_controller/
cont = controller.camelize.gsub(".rb","")
puts cont
(eval("#{cont}.new.methods") -
ApplicationController.methods -
Object.methods -
ApplicationController.new.methods).sort.each {|met|
puts "\t#{met}"
}
end
end
Elad, there's a problem with this code snippet...
ReplyDeleteIf a controller has an action (e.g. "new") that is also in ActionController, then that action is not listed by this script. At this moment I'm not sure what the solution is. But I thought I'd mention it in case anyone else stumbles across this post.
That's right... thankx for pointing that out.
ReplyDeletethe solution is to handle application_controller seperatly from the other controllers, i am sure you can figure out from this code how to do it.
if not, you can always ask me :)