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 separ
I usually do the following for my rails 4 projects:
In application.js
application.js
function onInit(callback){ $(document).ready(callback); $(document).on('page:load', callback); }
Then in the rest of the .js files, instead of using $(function (){}) I call onInit(function(){})
$(function (){})
onInit(function(){})