我在我的网页上显示的 Google 图表遇到了一个非常奇怪的问题。当我在 Mac 上本地运行代码时,一切正常,图形显示没有错误。
但是,当我在测试的 AWS 服务器上运行相同的应用程序时,我收到以下错误消息,但没有图表:
Data column(s) for axis #0 cannot be of type string
Run Code Online (Sandbox Code Playgroud)
该应用程序是用ruby-on-rails编写的,相关代码粘贴如下:
(在页面的控制器中)
relevantEntries = getDataFromDB
@graphData = Array.new
@graphData << ["Date", "Value"]
relevantEntries.each do |entry|
@graphData << [entry.created.strftime(format="%-m/%-d"), entry.value]
end
Run Code Online (Sandbox Code Playgroud)
(在页面视图中)
google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(ChartMaker);
function ChartMaker(chartDiv) {
// Create the data table.
var data = google.visualization.arrayToDataTable(<%= @graphData.to_json.html_safe %>);
// Set chart options
var options = {/* some options */};
// Instantiate and draw chart, passing in the options.
var chart = …Run Code Online (Sandbox Code Playgroud) 我正在尝试在Amazon的EC2服务器上部署Web应用程序,并且我在服务器上有代码.一切看起来都在工作,但是当我转到主页时,我收到500错误消息,该production.log文件给出了以下错误:
ActionView::Template::Error (image.png isn't precompiled)
Run Code Online (Sandbox Code Playgroud)
我试过跑rake assets:precompile,
我已经改变了行config/environments/production.rb到config.assets.compile = true
image.png内容public/assets/manifest.yml但我仍然得到同样的错误.
我正在运行Rails 3.2.6和Ruby 1.8.7.
谢谢你的帮助!