Reputation: 650
I have a rails app deployed on heroku and am having some issues getting new javascript, written with jquery, working on the deployed version of the site.
I've tried many different ways to precompile the assets, and it appears they are actually precompiled when deployed to heroku. I don't however believe that precompiling is the issue. The strange thing is I can see the new Javascript functions loaded in the browser.
So for example I have one simple function that hides a button until another button is clicked, very simple and it works fine in development. On the deployed version of the site I am able to find that function in the application.js source file but the button it should be hiding is not hidden.
So it seems the javascript is loaded, but not working. Has anyone experienced this issue when deploying with Heroku?
Here is an example of some of the javascript that is not working, again written in jquery.
$('#remove_sock_selection').click(function(){
$('#sock_images > ul > li > div').removeClass('selected').removeClass('make-thumbnail').removeClass('make-selected');
$('#sock_images > ul > li').removeClass('mx-0');
$('#sock_images > ul').removeClass('make-centered');
$('#sock_images').addClass('mt-5');
$('#sock_image_selected').hide();
$('#packaging_images').hide();
$('#addAdditionalSock').show();
});
it's really just adding/ removing css classes based on when things are clicked.
Upvotes: 0
Views: 89
Reputation: 11
Do you already reset the cache or reboot your production? could you send the js you added? Just double check your production system if already been reboot/reset cache of you rails. It is a common issue when a js file updated in the production.
or maybe try reset your browser cache. Hope this will help.
Upvotes: 1