【发布时间】:2013-04-22 19:33:02
【问题描述】:
以下在本地工作:
require 'sinatra'
get '/rand' do
["one", "two", "three"][rand(0..2)]
end
但是,在 heroku 上,我收到了 Internal Server Error。
有趣的是,这是可行的:
get '/rand' do
["one", "two", "three"][rand(2) - 1]
end
为什么?
【问题讨论】:
-
当您收到内部服务器错误时,您的 heroku 日志中有什么内容? devcenter.heroku.com/articles/logging#log-retrieval
-
我们试试Array#sample方法