【发布时间】:2015-05-07 01:52:16
【问题描述】:
我有以下 rails 配置:
Windows 7
Rails 4.1.1
Ruby 2.0.0p481
Gem: coffee-rails 4.0.1
Gem: coffee-script 2.3.0
Gem: coffee-script-source 1.9.1
我有一个运行良好的应用程序,但现在不行。我不记得有任何更改(git diff 没有透露任何内容)。我得到的错误是:
TypeError: Object doesn't support this property or method
(in c:/Users/mbratc01/Documents/Rails/manpower/app/assets/javascripts/welcome.js.coffee)
Extracted source (around line #9):
7 <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => false %>
8 <%= javascript_include_tag 'jquery-1.11.1', 'data-turbolinks-track' => false %>
9 <%= javascript_include_tag 'application', 'data-turbolinks-track' => false %>
10 <%= csrf_meta_tags %>
11 </head>
我真的还没有 Coffeescript 项目。 welcome.js.coffee的内容是:
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
我发现如果我只是将此文件移动到另一个无法访问的位置,应用程序运行良好。此外,在app/assets/javascript 文件夹中仅放置一个空的.coffee 文件会产生与上述相同的错误。
我在 StackOverflow 上看到了一些看起来非常相似的帖子,但是在阅读完这些帖子后,我找不到问题的根本原因,也无法在不删除 .coffee 的情况下解决它文件。我怀疑这里的 CoffeeScript 功能设置不太正确,但不确定是否安装了正确的 gem。
有人对可能导致此错误的原因提出建议吗?
【问题讨论】:
标签: ruby-on-rails-4 coffeescript