« 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.

The comments to this entry are closed.


  • 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.