我正在将旧应用程序升级到资产管道但是在关注升级到3.1的ryan bates教程后,我仍然无法利用pipline。为了排除我的升级过程,我创建了一个全新的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!"
这似乎是一个链轮问题,但我真的找不到任何有相同问题的人,或者资源文件夹中的其他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
我的ruby版本是2.0.0p195
感谢您的帮助!
答案 0 :(得分:0)
似乎红宝石版本是我的问题,我降级为红宝石1.9.3,然后重新安装宝石,它现在有效!