【问题标题】:Rails 3.1 asset pipeline not workingRails 3.1 资产管道不工作
【发布时间】:2013-06-22 22:41:36
【问题描述】:

我正在将旧应用程序升级到资产管道,但是在按照 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!"

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

这是我的 gem 文件:

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

感谢您的帮助!

G

【问题讨论】:

    标签: ruby-on-rails coffeescript asset-pipeline


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-23
      • 1970-01-01
      • 1970-01-01
      • 2012-02-04
      • 1970-01-01
      • 2011-10-04
      相关资源
      最近更新 更多