我的智慧结束了。似乎所有新的rails应用程序都在environments/production.rb
中设置了几个配置,部署并继续我的生活。但现在我们正在将一些rails应用程序迁移到新服务器,而且在部署到生产环境时似乎所有这些应用程序都存在此问题。
似乎正在发生的事情是我的javascripts或样式表都没有编译。我没有看到应用程序的样式,javascript也不起作用。
配置/ application.rb中:
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
Bundler.require(:default, :assets, Rails.env)
end
module MyApp
class Application < Rails::Application
... omitted code ...
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
config.generators.stylesheet_engine = :scss
end
end
配置/环境/ production.rb:
MyApp::Application.configure do
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
... omitted code ...
end
在我的申请中 - &lt; ...&gt; .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
;
我的应用程序 - &lt; ...&gt; .css完全为空。我错过了什么?
答案 0 :(得分:0)
所以昨天经过了漫长的半天和今天大约一个小时后,我突然意识到了一些事情......我之前遇到了这个问题。
果然......将rails更新到3.2.14并再次部署修复了整个事情。