Helper methods in coffescript files

Hi, I was wondering if there is a way to make helper methods available
in my .coffe files, Im trying to generate a graph from some userdata
with a javascript library, and with the new asset pipeline I can
append .erb so its users.js.coffe.erb which works just great, but I
need some way to get the current_user helper method… help ?

On Jun 20, 2011, at 4:31 AM, Jonathan Borg wrote:

Hi, I was wondering if there is a way to make helper methods available
in my .coffe files, Im trying to generate a graph from some userdata
with a javascript library, and with the new asset pipeline I can
append .erb so its users.js.coffe.erb which works just great, but I
need some way to get the current_user helper method… help ?

I am not sure this is such a good idea. Your js, ideally, will be
concatenated and compressed and cached. Anything variable ought to be
in the HTML, since that changes more frequently, and your js should
simply look for the variable within the page and act upon it in the DOM.

Walter

Hi,

apart from the fact, that it might not be a good idea in terms of
performance …
Is it possible? I am trying the same.

Best regards

Robert

sorry, had not read the full original post

Hi Noel,

thanks - the question is concerning helper methods. How can I use helper
methods in the asset pipeline?

Best regards

you can do
myfile.js.coffee.erb

first it will be processed by ERB then CoffeeScript