Get method names?


#1

hi all

I developed user management with roles and rights, what i need now is to
build user management interface, to give roles and rights to user.

Is it possible to call controller and get all methods in a controller?
is it possible to get all controller names ?

i think something like class.method_names…

anybody?

thanks

serz


#2

Hi

Can you use Module#instance_methods ?
For example admin_controller.instance_methods

burlight

On Mar 12, 2:53 pm, sine serz removed_email_address@domain.invalid


#3

burlight wrote:

Hi

Can you use Module#instance_methods ?
For example admin_controller.instance_methods

burlight

On Mar 12, 2:53 pm, sine serz removed_email_address@domain.invalid

thanks burlight :wink:


#4

sine serz wrote:

burlight wrote:

Hi

Can you use Module#instance_methods ?
For example admin_controller.instance_methods

burlight

On Mar 12, 2:53 pm, sine serz removed_email_address@domain.invalid

thanks burlight :wink:

Module#instance_methods, return all methods in a controller, but i only
need my methods in a controller not system methods.
Is it possible to get only def`s in a controller in some way?

What i was thinking is to open file then scan thru and pickup all
methods.

but this is not nice.

Any1 have an Idea?

thanks

serz


#5

Hi serz,

Module#instance_methods, return all methods in a controller,
but i only need my methods in a controller not system methods.
Is it possible to get only def`s in a controller in some way?

What i was thinking is to open file then scan thru and pickup all
methods.

See ActionController::Base.action_methods and
ActionController::Base#action_methods

– Jean-François.


Ruby ( http://www.rubyfrance.org ) on Rails ( http://www.railsfrance.org
)


#6

Jamal S. wrote:

sine serz wrote:

hi all

I developed user management with roles and rights, what i need now is to
build user management interface, to give roles and rights to user.

Is it possible to call controller and get all methods in a controller?
is it possible to get all controller names ?

i think something like class.method_names…

anybody?

thanks

serz

Maybe give you another solution if you tell us why you need to get
output all the methods in the controller?

thanks all, controller.action_methods works well.

I need this cause i am developing user management system, with roles and
rights, so i need to call all action_methods in a controller, so i could
give rights to roles and users.

thanks again


#7

sine serz wrote:

hi all

I developed user management with roles and rights, what i need now is to
build user management interface, to give roles and rights to user.

Is it possible to call controller and get all methods in a controller?
is it possible to get all controller names ?

i think something like class.method_names…

anybody?

thanks

serz

Maybe give you another solution if you tell us why you need to get
output all the methods in the controller?


#8

sine serz wrote:

Jamal S. wrote:

sine serz wrote:

hi all

I developed user management with roles and rights, what i need now is to
build user management interface, to give roles and rights to user.

Is it possible to call controller and get all methods in a controller?
is it possible to get all controller names ?

i think something like class.method_names…

anybody?

thanks

serz

Maybe give you another solution if you tell us why you need to get
output all the methods in the controller?

thanks all, controller.action_methods works well.

I need this cause i am developing user management system, with roles and
rights, so i need to call all action_methods in a controller, so i could
give rights to roles and users.

thanks again

I don’t know what you are trying to do exactly with the action_methods,
did you try to look at the before_filter? you can use it in your
controller, and give rights to certain methods for different user roles
:slight_smile:

before_filter :is_admin, :only => %w{method methodto}