Is there any way to use a Rails helper method, more specifically, a path helper method within a javascript asset file. This file foo.js.coffee.erb
I'm not quite sure, why you want to do this.
You would prevent the javascript file from being cached, as it contains a dynamic value
You would get a coupling between your javascript/coffeescript and rails
If possible I would advice you to abstract your problem away by providing your target path in the view and retrieve the value from the DOM-Element when the specific event occurs. Just like 'Unobtrusive Scripting Adapters' for Rails do. E.g.: https://github.com/rails/jquery-ujs/blob/master/src/rails.js#L157-173