“TypeError:无法在生产模式下调用未定义的方法'write'

时间:2012-11-13 13:17:12

标签: ruby-on-rails deployment production actionview

当我在本地系统上运行我的小应用程序时,一切正常。当我转向制作时,我收到错误500消息(我们很抱歉,但出了点问题。)。我的production.log fiel显示了这个:

Started GET "/" for 79.203.113.136 at 2012-11-13 13:54:06 +0100
Processing by DayviewController#index as HTML
  Rendered dayview/index.html.erb within layouts/application (0.4ms)
Completed 500 Internal Server Error in 1783ms

ActionView::Template::Error (TypeError: Cannot call method 'write' of undefined
at /tmp/execjs20121113-27948-1cczq8s.js:5043:20
at /tmp/execjs20121113-27948-1cczq8s.js:5057:16
at /tmp/execjs20121113-27948-1cczq8s.js:1:92
at Object.<anonymous> (/tmp/execjs20121113-27948-1cczq8s.js:1:109)
at Module._loadContent (node.js:667:21)
at node.js:695:20
at node.js:304:23
at node.js:756:9

(in /home/www/pvdaheim/app/assets/javascripts/jquery-1.8.2.min.js)):
5:   <%= stylesheet_link_tag    "application", :media => "all" %>
6:   <%= javascript_include_tag "application" %>
7:   <%= javascript_include_tag :defaults %>  
8:   <%= javascript_include_tag "jquery-1.8.2.min", "jquery-ui-1.8.23.custom.min", "jquery.ui.datepicker", "rails", "highcharts", "highstock" %>
9:   <%= csrf_meta_tags %>
10: </head>
11: <body>
 app/views/layouts/application.html.erb:8:in `_app_views_layouts_application_html_erb___1022895261_93021610'

我没有名为/tmp/execjs20121113-27948-1cczq8s.js的文件。我在论坛中发现了一些类似的问题,但没有一个对我有所帮助。

谢谢&amp;此致,Andreas

这是我的index.html.erb:

<div id="container2" style="height:500px; background-color:#999999; border:thin solid">
</div>

<script type="text/javascript" src="./pv_andreas/wr.js"></script>?
<script type='text/javascript'>//<![CDATA[ 

$(function() {
    var chart = new Highcharts.StockChart({
    ... highstock stuff rendered to container2...
});
//]]>
</script>

这是我的routes.rb:

Pvdaheim::Application.routes.draw do
  get "dayview/index"
  root :to => 'dayview#index'
end

1 个答案:

答案 0 :(得分:-1)

删除路径文件中的get "dayview/index",它将起作用。