【发布时间】:2012-11-13 13:17:11
【问题描述】:
当我在本地系统上运行我的小应用程序时,一切正常。当我开始生产时,我收到错误 500 消息(很抱歉,出现了问题。)。我的 production.log 字段显示如下:
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 的文件。我在论坛中发现了一些类似的问题,但没有一个对我的修复有帮助。
感谢和问候,安德烈亚斯
这是我的 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
【问题讨论】:
-
请发布您的
index.html.erb和路线。 -
我已经添加了 index.html.erb 和 routes.rb。如前所述,它现在是一个非常小的项目。
-
尝试删除
get "dayview/index",并确保您删除了public文件夹中的index.html。 -
非常感谢,index.html 已公开删除,但删除 get "dayview/index" 解决了该问题。你能告诉我为什么吗?
-
我认为action只映射到一个路径,所以在执行action index的时候,不知道会使用哪个路由,
get或者root,所以去掉get就可以了知道需要做什么。我将发布我对您的问题的回答以使其被接受。请接受我的回答,谢谢;)
标签: ruby-on-rails deployment production actionview