我最近更新了 Rails 应用程序中的一些软件包,但现在我的资产无法提供服务。相反,我收到以下错误:
Failed to load resource: the server responded with a status of 404 (Not Found)
我的资产已预编译:
资产.rb
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
Rails.application.config.assets.precompile += %w(ckeditor/*)
Rails.application.config.assets.precompile += %w(ckeditor/config.js)
Rails.application.config.assets.precompile += %w( *.js ^[^_]*.css *.css.erb )
应用程序.rb
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module DeployTest
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
config.assets.precompile += Ckeditor.assets
config.assets.precompile += %w( ckeditor/* )
config.autoload_paths += %W(#{config.root}/app/models/ckeditor)
config.active_record.default_timezone = :local
config.time_zone = 'Eastern Time (US & Canada)'
end
end
在告诉我打开编译我的资产之前,请理解这是
A可怕的主意 https://stackoverflow.com/questions/8821864/config-assets-compile-true-in-rails-production-why-not。感谢您的任何建议
UPDATE:我通过添加以下内容使其工作:
config.assets.digest = true
to my config/environments/staging.rb
文件。奇怪的是我以前不需要它