Kai,

I've gone through this same headache.  I too wanted to use a helper
but couldn't.  Have you considered using content_for in view and then
reference it in the <head> section of the layout to generate the
javascript?

I couldn't do it that way because I was doing AJAX calls so the <head>
section didn't change.

HTH,
Dan

On Jan 22, 6:33 am, Kai Schlamp <[email protected]> wrote:
> On Jan 22, 8:07 am, Marnen Laibow-Koser <[email protected]> wrote:
>
> > KaiSchlampwrote in post #976711:
>
> > > Uuups, I just found out that HTML links behave the same way ... it
> > > seems I am too pampered with Rails link helpers ;-)
>
> > Apparently so.  If you don't understand relative URLs, you have no
> > business doing Web development.
>
> Thanks for the suggestion :-P
>
> > > But I still wonder
> > > what the easiest way would be to build correct URLs for Javascript
> > > then.
>
> > Use absolute URLs (the *_url helpers will produce these).
>
> That is not an option for Javascript files that live in public/
> javascript, as those won't be generated. An option I guess would be to
> set some kind of data-url tag and query that by using Javascript. But
> I handle it the pure Javascript way now with a little helper function.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to