我看过一些类似的帖子,但没有解决方案,所以我想我会提出一个更多记录的问题。
清单文件中的我的问题JS 不包含或编译任何 JS。
在本地运行我的服务器并打开 JS 文件时,我没有看到任何编译的内容,只有标准的 application.js 清单文件:
// 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
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require underscore
//= require backbone
//= require backbone_rails_sync
//= require backbone_datalink
//= require backbone/myapp
//= require_tree .
我的 development.rb :
MyApp::Application.configure do
config.cache_classes = false
config.whiny_nils = true
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_mailer.raise_delivery_errors = false
config.active_support.deprecation = :log
config.action_dispatch.best_standards_support = :builtin
config.active_record.mass_assignment_sanitizer = :strict
config.active_record.auto_explain_threshold_in_seconds = 0.5
config.assets.compress = false
config.assets.debug = true
end
我的 application.rb :
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
Bundler.require(*Rails.groups(:assets => %w(development test)))
end
module MyApp
class Application < Rails::Application
config.encoding = "utf-8"
config.filter_parameters += [:password]
config.active_support.escape_html_entities_in_json = true
config.active_record.whitelist_attributes = true
config.assets.enabled = true
config.assets.version = '1.0'
end
end
我的日志:
Started GET "/questions" for 127.0.0.1 at 2013-04-04 08:56:09 -0400
Processing by QuestionsController#index as HTML
Completed 200 OK in 204ms (Views: 16.0ms | ActiveRecord: 17.4ms)
Started GET "/assets/application.css" for 127.0.0.1 at 2013-04-04 08:56:09 -0400
Served asset /application.css - 304 Not Modified (2ms)
Started GET "/assets/application.js" for 127.0.0.1 at 2013-04-04 08:56:09 -0400
Served asset /application.js - 304 Not Modified (0ms)
Started GET "/assets/favicon.png" for 127.0.0.1 at 2013-04-04 08:56:09 -0400
Served asset /favicon.png - 304 Not Modified (0ms)
需要注意的是,当我从 MongoDB 构建迁移到 Postgres 构建时,这个应用程序是从另一个应用程序中挑选出来的。所以我认为这很可能与一些未经挑选的细节有关。
可以通过执行此问题来重现此问题 ..
$ rvm use ruby-2.0.0-p0
$ rails new project
alert('hey')
在其中创建一个javascript文件/assets/javascripts/
$ rails s
我认为这个问题是因为 Ruby 2 还不能与 Rails 一起工作:(
我已将其正式确定为与 Rails 3.2.6 不兼容的 Ruby 2