Ruby method only use second optional parameter

I have a method:

def my_method(id,raise_error=true,validate=false)
...
end

How can I call this method with only using the second optional parameter?

I tried:

my_method(20,,false)

Would it be better here to use an options hash?


Source: ruby

Leave a Reply