rails 3.1 asset pipeline exposing defined functions and (classes and coffeescript)


what is the best/preferred/recommended way to expose functions (and classes in coffeescript)

to the browser.

At the moment i do this

@func = → “a function def” which translates into

this.func = function(){return “a function def”}

where this is the browser window.

Actually it works … however it feels somehow wrong. I’d rather use the commonJS module system.

Any comments?

Best regards