当我使用
然而,当我将文字哈希值用括号括起来时,就像这样:
respond_with
并传递一个字面哈希时,它会给我返回错误:syntax error, unexpected tASSOC, expecting '}'
`respond_with {:status => "Not found"}`
然而,当我将文字哈希值用括号括起来时,就像这样:
respond_with({:status => "Not found"})
该函数运行得非常顺利。为什么括号会有所区别?难道哈希不是一个封闭的调用吗?
respond_with :status => "Not found"
。 - TimPetricola