Results 1 to 11 of 11
Jun 16, 2006, 07:57 #1
- Join Date
- Sep 2000
- 0 Post(s)
- 0 Thread(s)
Listing all controllers and actions in Rails
I'm still getting the hang of both Ruby and Rails coming from PHP, but I'm writing a CMS at the moment and the permission system is based on the controllers, actions and IDs.
In the admin area of the app, the administrator needs to be able to add new permissions and rather than have the admin type them in (requiring knowledge of the application code), I'd like to auto-list the controllers and actions within those controllers with select boxes.
The time-consuming way is to keep a list of all the controllers and actions in the app, but it must be possible to list the controllers (by reading the files in the /controllers folder and getting the names from there) and to then retrieve the available methods in each controller class, but I don't know how I'd go about it in Ruby.
Can anyone explain how I could get the list of controllers and then actions within those controllers or point at a resource somewhere else that explains it please?