I’m trying to pass a nest of parameters to a rails function defined as so…
def test(*params)
stuff
end
If I pass the following
test :mark, :was, :here
or
test :mark, :was, :here=>:today
everything is fine. However, when I do this…
test :mark, :was=>:really, :here
An error is thrown. Any clues where I’m going wrong?
M.
If the last argument is a hash you don’t have to use curly barces, but if the hash is not at the end of your list of arguments you do need the curly braces. In the middle Ruby doesn’t know if the comma indicates the next argument or the next item in the hash. So you have to do this: