Listing actions of the controller

Hi to all,

Is it possible to list out all the actions inside the controller.

Thanks in Advance
Saravanan

hi saravanan!

Saravanan K. [2008-04-30 15:04]:

Is it possible to list out all the actions inside the controller.
YourController.public_instance_methods(false)

hth
jens


Jens W., Dipl.-Bibl. (FH)
prometheus - Das verteilte digitale Bildarchiv für Forschung & Lehre
Kunsthistorisches Institut der Universität zu
KölnAlbertus-Magnus-Platz, D-50923
KölnTel.: +49 (0)221 470-6668, E-Mail: [email protected]
http://www.prometheus-bildarchiv.de/

Hi –

On Wed, 30 Apr 2008, Saravanan K. wrote:

Hi to all,

Is it possible to list out all the actions inside the controller.

I don’t know whether there’s anything higher lever, but from inside an
action try this:

self.class.instance_methods(false)

It won’t, of course, mention cases where you’ve got a template but no
action definition… but it’s not such a bad idea to put empty actions
in your controller for those cases anyway. (At least, I like to.)

David


Rails training from David A. Black and Ruby Power and Light:
INTRO TO RAILS June 9-12 Berlin
ADVANCING WITH RAILS June 16-19 Berlin
INTRO TO RAILS June 24-27 London (Skills Matter)
See http://www.rubypal.com for details and updates!

Visit Indonesia 2008 wrote:

and how to get method in private, i run your scripts above, and they
only show public method. Thank you

Reinhart
Http://teapoci.blogspot.com

to get method in private,
UploadController.private_instance_methods(false)

to get method in protected,
UploadController.protected_instance_methods(false)

and how to get method in private, i run your scripts above, and they
only show public method. Thank you

Reinhart
Http://teapoci.blogspot.com

On Wed, Apr 30, 2008 at 8:04 AM, Saravanan K.
[email protected] wrote:

Hi to all,

Is it possible to list out all the actions inside the controller.

This is how I did it once when I needed them as options for a select:

http://destiney.com/blog/rubyonrails-get-public-actions-from-a-controller


Greg D.
http://destiney.com/

On 30 Apr 2008, at 14:10, David A. Black wrote:

I don’t know whether there’s anything higher lever, but from inside an
action try this:

self.class.instance_methods(false)

Maybe SomeController.action_methods ? (subject of course to the same
caveats you give below)

Fred

Hi –

On Wed, 30 Apr 2008, Frederick C. wrote:

Hi to all,
caveats you give below)
I KNEW Rails must have gotten there before me :slight_smile: I’m just such a
low-level kind of person…

David


Rails training from David A. Black and Ruby Power and Light:
INTRO TO RAILS June 9-12 Berlin
ADVANCING WITH RAILS June 16-19 Berlin
INTRO TO RAILS June 24-27 London (Skills Matter)
See http://www.rubypal.com for details and updates!

Frederick C. [2008-04-30 16:35]:

Maybe SomeController.action_methods ?
this includes inherited and included methods as well (namely from
ApplicationController, which seems undesirable). OTOH, it respects
hidden actions. so, to combine the two:

SomeController.public_instance_methods(false) -
SomeController.hidden_actions

oh, one more thing: if you have filter_parameter_logging in your
controller, filter_parameters will be added to that controller’s
public instance methods.

cheers
jens