Using coffeescript, jQuery and asterisks in rails 3.1, coffeescript files are compiled into blocks, such as:
(function() { var a; var b; var c; foo = function() { alert("foo"); } bar = function() { alert("bar"); } }).call(this);
This seems to move the foo and bar functions out of the global scope, so bar can be called foo, but none of them can be called from html code. When I try to call foo from the select onchange element, I get "Can't find variable: foo".
The workaround right now is to move all globally available functions to .js files. But what is the right way to do this?
thanks
source share