controllers = Dir.new("#{RAILS_ROOT}/app/controllers").entries controllers.each do |controller| if controller =~ /_controller/ control = controller.camelize.gsub(".rb", "") puts control (eval("#{control}.new.methods") - ApplicationController.methods - Object.methods - ApplicationController.new.methods).sort.each {|method| puts "\t#{method}" } end end
?
示例输出:
?
EntriesController
??????? create
??????? destroy
??????? update
EntryCommentsController
??????? create
??????? destroy
??????? update