Rails 4: how to use $(document).ready() with turbo-links
问题 I ran into an issue in my Rails 4 app while trying to organize JS files \"the rails way\". They were previously scattered across different views. I organized them into separate files and compile them with the assets pipeline. However, I just learned that jQuery\'s \"ready\" event doesn\'t fire on subsequent clicks when turbo-linking is turned on. The first time you load a page it works. But when you click a link, anything inside the ready( function($) { won\'t get executed (because the page