我已经搜索了这个问题的解决方案,我发现我必须运行bundle exec rake资产:在推送到heroku之前预编译以使JavaScript工作但它不工作我不知道为什么。和本地生产相同
production.rb
config.cache_classes = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.serve_static_assets = true
config.assets.compress = true
config.assets.compile = false
config.assets.precompile += %w( chartkick.js )
config.i18n.fallbacks = true
end
的application.js
//= require jquery_ujs
//= require jquery
//= require jquery.ui.all
//= require bootstrap
//= require demo1
//= require polyfills
//= require announcements
//= require wice_grid
//= require ckeditor/init
//= require bootstrap-datepicker
//= require_tree .
更新:它不能用于开发。它几分钟前工作..:|
更新2:在将application.js重新排序到以下内容后,它在开发中工作:
//= require jquery_ujs
//= require bootstrap
//= require jquery
//= require jquery.ui.all
//= require demo1
//= require polyfills
//= require announcements
//= require wice_grid
//= require ckeditor/init
//= require bootstrap-datepicker
//= require_tree .
仍然无法在生产中使用
答案 0 :(得分:1)
您应该设置: -
config.assets.compile = true