« An alternative theory for "subconsciousness", Part 2 | Main | EDU 2.0 in the News »

Oct 26, 2010



Perhaps surprisingly ruby has no means to get parameter names.

Merb (presumably to achieve what you describe here) has 'action-args'. The implementation is quite exciting, one for each of jruby, mri and 1.9.



I don't believe that Ruby itself provides the necessary function to do this: if you get access to a method, you can determine its "arity" but not the names of arguments.

The closest you could come is something like this:

action :mymethods, [:a, :b] do

For bonus points, the action method could define the necessary route.

Graham Glass

According to this, there are a few ways to get method names via reflection:


Perhaps this is something new in Ruby 1.9?

Robert W. Oliver II

This might show Rails's heritage from a fed-up PHP developer. Having to set the variables from the param[] array might help prevent against security attacks and trying to chase down order-of-insertion bugs.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment

Comments are moderated, and will not appear until the author has approved them.

Your Information

(Name is required. Email address will not be displayed with the comment.)


  • Destiny is my science fiction movie about the future of humanity. It's an epic, similar in breadth and scope to 2001: A Space Odyssey.

    To see the 18 minute video, click on the graphic below.