【发布时间】:2014-04-14 21:52:38
【问题描述】:
我是 Ruby 的新手,正在做我的第一个项目。这是我正在使用的版本...
- 红宝石 2.1.1p76
- Rails 4.1.0
我在添加 JavaScript 文件时遇到问题。我正在关注this article(特别是Site-wide Scripts部分)阅读文章后,我将jquery.js & jquery.validate.min.js保存在vendor/assets/javascripts下和我自己的脚本app/assets/javascripts/additionalJS目录下的accRefConfig.js
这就是我的 app/assets/javascripts/application.js 清单的样子(没有删除 cmets,希望没关系):
// This is a manifest file that'll be compiled into application.js, which will include all the files listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details about supported directives.
//
// = require jquery
// = require jquery.validate.min
// = require_tree ./additionalJS
还有我的应用程序布局...
<head>
<title>Hello World</title>
<%= stylesheet_link_tag "application.css", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application" %>
</head>
但这给了我以下错误....
我做错了什么?提前感谢您的时间和帮助:)
顺便说一句,我也试过<%= javascript_include_tag "application.js" %>,但同样的错误信息
【问题讨论】:
-
@railsr,感谢您的回复。我现在无法访问我的虚拟机,当我有机会尝试时会通知你:)
标签: javascript ruby-on-rails ruby asset-pipeline ruby-on-rails-4.1