views:

20

answers:

1

I would like to define a method where the first argument is required and the rest are optional. Only first argument must be at first pace.

I try to do this:

my_method(:id, :tags, :user)
my_method(:id, :user, :tags)

def(id, *args)
 ... id...
 ... args[:tags]...
 ... args[:user]...
end

Thank you!

+1  A: 

Found it! def(id, options={}) end

xpepermint