I’d like to have a method that is similar to this:
def method_with_optional(..., user = current_user, account = current_account)
...
because, I don’t want to have to pass in current_user, and current_account every time.
but as long as a user object isn’t passed, the user formal parameter shouldn’t be over-ridden.
This way I could do the following
method_with_optional(params[:id])
or
method_with_optional(params[:id], User.new)
What you’re looking for are named arguments, which is not supported in Ruby 1.8, but you may have some success with arguments.