我最近在我的Rails应用程序中更新了一些软件包,现在我的资产没有被提供。相反,我收到以下错误:
Failed to load resource: the server responded with a status of 404 (Not Found)
我的资产已预先编译:
assets.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 )
application.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
在告诉我打开编译我的资产之前,请理解这是 一个horrible idea。感谢您的任何建议
更新:我通过添加:
来实现它 config.assets.digest = true
到我的config/environments/staging.rb
文件。
答案 0 :(得分:2)
有时您需要将这两种配置都添加到staging.rb或要反映更改的环境中。
this.dataSource= new MatTableDataSource(this.searchResult);