class MyController < ApplicationController
def find(term, limit=10, offset=0)
# if params[:limit] exists, it would be passed as the limit argument when the method is called by ActionDispatcher. Otherwise, 10 would be assumed
# raise BindingNotPresent unless params[:term].present?
end
end
Grails 2 will also bring such kind of feature and, as types can be optionally declared in Groovy, it is able to automatically type cast params too.
As a curious note, Perl 6 has a great feature (among several others) that will enable you to write a main function that will bind arguments from the command line to the function params names too:
I don't use Ruby 1.8 for a long time (except in applications such as Gitorious that still use old Rails that didn't supported 1.9 very well with regards to unicode).
But since I'm suggesting this to be included directly in Rails, I think it should support Ruby 1.8 too until Rails drops support for 1.8.
Maybe Rails 3.2 will drop 1.8 support and this could be included in next major Rails version...