In a rails application. I want to create a coffeescript function that can be shared by multiple coffeescripts.
for example
- app/assets/javascripts/util.js.coffee
sample_function = (word) -> console.log word
- app/assets/javascripts/sign_up/common.js.coffee
how to import and use the sample_function
I tried:
//= require '../util'
sample_function('hello world')
It says sample_function is undefined.