Last Updated: February 25, 2016
·
1.358K
· montas

Double javascripts in rails app

If you ever run into problem with all your javascripts included twice in your page (this may result in dropdowns not opening or any toggling scripts malfuction), check your public folder for precompiled assets like application.js.

If you found some, you probably did "rake assets:precompile" for testing production version of your site. Precompile copied compiled "application.js", including all your jQuerys and Bootstraps, into your public folder. This compiled version of "application.js" then get served to browser instead of empty "application.js" from your assets.

This results in browser including non-precompiled versions of scripts included in "assets/javascripts/application.js" and "public/applications.js" file with precompiled versions of your scripts.