我已经搜索了这个问题的解决方案,我发现我必须在推送到 heroku 之前运行 bundle exec rake assets:precompile 才能使 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
应用程序.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 .
仍然无法在生产中工作