How can I use option --bare in Rails 3.1 for CoffeeScript?

Someone know how can I use this option in Rails 3.1?
Now CoffeScript puts a function ".call(this)" on each file, but I want
to remove this.

+1 This seems to affect functions too, since Coffeescript makes functions into vairables, and those variables aren’t available outside of that scope.

you can use

class window.MyClassName or

window.functionName =

Check out this here:

No need to go bare.

If you want to run it both on node and client you can do something like this (taken from

root = exports ? @

root.alertMe =(msg) ->

alert msg

alertMe ‘hi there’

The following should actually work too for client side only (not battle tested here though)

@.alertMe =(msg) ->

alert msg

It is a matter of personal style I guess