refactor for requirejs-rails