How to get all models,controller,action and method names

Answering the following post that I could not (did not know how to) re- open:

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/6d9a5679d73b0a6b/d17adc61119d2acc?lnk=gst&q=All+controllers'+action+names#d17adc61119d2acc

I have been working on getting a list of all actions in every controller of my application to automate certain process. I found a couple of links with some useful information that lead me to write this code:

<code>     # This produces an array with subclasses names.     ApplicationController.subclasses.sort.each do |subclass|

      # This creates a new instance of a controller based on the subclass name.       controller = subclass.constantize.new

      # This creates an anonymous singleton class in which I declare       # a public method that accesses private method 'action_methods',       # which returns the controller actions       class << controller         def my_action_methods           action_methods         end       end </code>

I hope this helps somebody.

<code> # This creates an anonymous singleton class in which I declare # a public method that accesses private method 'action_methods', # which returns the controller actions class << controller def my_action_methods action_methods end end </code>

Maybe I should have mentioned that now you can access the controller actions with:

<code>   controller.my_action_methods </code>