Url helper in model.js.erb.cofee (Sprockets::Context)

hello,
I am writing a js/coffee file that gets erb handling and I need to use
a url helper inside this file
if write

url: ‘<%= url_for(:action => :index) %>’

I get an error:
NoMethodError Exception: undefined method `url_for’ for #<#<Class:
0xbdbb068>:0xeed1eb8>

self.class
#Class:0xbdbb068 < Sprockets::Context

How do I make url_for accessible in Sprockets::Context?

thank you.

On 10 Nov 2011, at 06:04, slava wrote:

self.class
#Class:0xbdbb068 < Sprockets::Context

How do I make url_for accessible in Sprockets::Context?

http://stackoverflow.com/questions/7517140/why-are-the-actionviewhelpersurlhelper-not-available-in-the-assets-pipeline

Best regards

Peter De Berdt

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs