意外令牌:在 heroku 上的 JSON 中,在本地运行良好

Unexpected token : in JSON on heroku, runs fine locally

有问题的行:

render(json: {'token': token} ) and return

/app/app/controllers/authentications_controller.rb:29: syntax error, unexpected ':', expecting => render(json: {'token': token} ) and return

我可以

rails s

本地就好了。

什么给了?

{'token': token} 不会在 Ruby 中工作(但是),您必须使用 {'token' => token} 作为字符串的键。