Rails root_path in application.js

How can I get my hands on the project's root_path in my application.js file?

I need it for a js plugin (codemirror) that needs to load other JS files. It's all fine and dandy if I say "/javascripts/needed_file.js", but what if I deploy my project to "/custom".

The code needs to do its magic all over the project and I would like it to be UJS, so it needs to be in a static javascript file.

Any solutions/simple hacks?

6
задан Arslan Ali 21 November 2016 в 14:57
поделиться