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%27+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.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.