Can you remove your javascript from application.js and add the following to base.html.erb directly after the opening head element: 

<script>
(function(){
    var el = document.getElementsByTagName('html')[0];
    el.className = el.className.replace('no-js','js');
})();
</script>