【发布时间】:2015-11-25 21:08:28
【问题描述】:
我正在关注 Fernando Villalobos 的 React.js - A guide for Rails developers AirPair 教程。
这里的目标是使用 Rails 和 React JS 构建一个简单的费用跟踪应用程序。
在Nesting Components: Listing Records部分,作者建议创建app/views/records/index.html.erb文件如下:
<%# app/views/records/index.html.erb %>
<%= react_component 'Records', { data: @records } %>
和一个javascripts/components/records.js.coffee 文件如下:
# app/assets/javascripts/components/records.js.coffee
@Records = React.createClass
render: ->
React.DOM.div
className: 'records'
React.DOM.h2
className: 'title'
'Records'
然后,当我们访问localhost:3000/records 时,我们应该会看到以下内容:
但是,当我访问localhost:3000/records 时,我收到以下错误:
ExecJS::RuntimeError in Records#index
SyntaxError: [stdin]:7:10: cannot have an implicit value in an implicit object
<title>Expenses</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
<body>
特别是,导致问题的行似乎是:
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
知道问题是什么以及如何使事情发挥作用吗?
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-4 coffeescript reactjs