[Rails] 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=gstq=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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] How to get all models,controller,action and method names in
Hi guys, In runtime we can get the current controller and current action names by controller_name and action_name methods like wise, I want to get all the remaining controllers and action names and models too if possible.. Any rails method available to get all the controller names and the action names in application controller. Thanks in Advance, Ramanaa Selvaa -- Posted via http://www.ruby-forum.com/. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.