当我配置我的应用程序文件时,我将我的插件文件夹放在资产下,在我的config / 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 Cnd
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.1
config.assets.paths << Rails.root.join("app", "assets", "fonts")
config.assets.paths << Rails.root.join("app", "assets", "images")
config.assets.paths << Rails.root.join("app", "assets", "bootstrap")
config.assets.paths << Rails.root.join("app", "assets", "rs-plugin-5")
config.assets.paths << Rails.root.join("app", "assets", "magnific-popup")
config.assets.paths << Rails.root.join("app", "assets", "owlcarousel2")
config.assets.paths << Rails.root.join("app", "assets", "morphext")
# 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.
end
end
当我部署到亚马逊ec2时,我的本地主机上运行正常我收到以下错误:
我不明白为什么它会在本地加载文件,但是当我部署文件时却没有。我现在只是在开发环境中部署。不确定这是否有所不同,但我在本地工作生产环境,所以我预先编译了资产。我在开发中部署的原因是因为我只需要快速向客户展示进度。
答案 0 :(得分:0)
经过一番工作,我明白了。我不得不使用这行RAILS_ENV=production bundle exec rake assets:clobber
来摆脱预编译,然后一切都恢复正常。现在,当我准备好生产时,我需要弄清楚如何预编译所有资产,包括插件。