I am struggling.
I have a rails 5 application with a series of js files in the app / assets / javascripts folder. Js in these files works fine in the development environment, but when I publish on heroku, it stops working.
I see from the chrome inspector that the application.js file, which is visible on the network tab, shows the contents of the js files in my application. It just doesn't work in production. No console errors appear in the xrome console.
I see from this post that there are a number of things to try. I tried them all. I even made a completely new application and added the js files at a time to see if there is a tipping point when something is needed in a different order for something else (mostly guessing), but it doesn’t fix the problem.
I see from this article that one of the suggestions:
config.assets.compile = false
and then try:
rake assets:clean assets:precompile
I have tried each of these suggestions and still cannot find the problem.
If an error occurred in the way I wrote js, I would expect this to appear both in my installation console and in the operating environment on chrome. There are no errors in both environments.
, js , , , js, , , .
?
:
//JavaScripts/application.js
//assets.rb
Rails.application.config.assets.version = '1.0'
/production.rb
config.assets.compile = false
, , app/assets/javscripts/stance/commercial.js( application.js // = require_tree.
:
jQuery(document).ready(function() {
jQuery('[name="organisation[commercial_attributes][standard_financial_split]"]').on('click', function() {
if (jQuery(this).val() == 'true' ) {
jQuery('#commercial_standard_financial_split_content').removeClass('hidden');
} else {
jQuery('#commercial_standard_financial_split_content').removeClass('hidden').addClass('hidden');
}
});
});
- js ?
, , , , ( , , ), " t , .