title: How to get list of controllers and actions in ruby on rails?
body: <p>In rails, I can get the name of the current controller via controller_name and the current action by calling action_name. I am looking for similar runtime reflection for fetching the following:</p>
  
  <ol>
  <li>List of all controllers in the application. </li>
  <li>List of all actions in a given controller.  </li>
  </ol>
  
  <p>For example, I  a  Product controller which has "add" and "edit" actions.  Can I pull the names of these actions programmatically to show the user what operations are supported?  </p>
  
  <p>I have looked at a method that calls for use of <code>ActionController::Routing::Routes.named_routes.routes.each</code> 
  but I could not get that to work.  I got uninitialized constant <code>ActionDispatch::Routing::Routes</code> error when I used it.</p>
  
  <p>If there is any good tutorial or document that can help me understand how rails reflection capabilities.  I searched for it but I mostly got active record reflection related blogs.  I am looking for something that lets me get information on controllers and actions/methods at run time.<br>
  Thanks,</p>
  
  <p>Tabrez</p>