1

我正在将旧应用程序升级到资产管道,但是在按照 ryan bates 升级到 3.1 的教程之后,我仍然无法利用管道。为了排除我的升级过程,我创建了一个新的 rails 应用程序并尝试了一些咖啡脚本并将其他文件添加到 /assets/javascripts 文件夹,但是除了 application.js 之外的任何其他文件似乎都没有呈现。

这是我的 application.js 文件:

// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require_tree .


alert("this displays fine");

以及额外的 dogs.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://jashkenas.github.com/coffee-script/

alert "cant see this!"

这似乎是一个 sprockets 问题,但我真的找不到任何有同样问题的人,或者关于资产文件夹中的其他 javascript 文件何时不通过 require_tree 包含在 application.js 中的信息。

这是我的宝石文件:

gem 'rails', '3.1.1'
gem 'sqlite3'
group :assets do
  gem 'sass-rails',   '~> 3.1.4'
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'

group :test do
  # Pretty printed test output
  gem 'turn', :require => false
end

我的红宝石版本是 2.0.0p195

谢谢你的帮助!

G

4

1 回答 1

0

看来 ruby​​ 版本是我的问题,我降级到 ruby​​ 1.9.3,然后重新安装 gems,它现在可以工作了!

于 2013-06-23T04:56:35.990 回答