Is there a way of executing embedded ruby in a javascript file in my /public/javascripts directory?

Posted by brad on Stack Overflow See other posts from Stack Overflow or by brad
Published on 2010-04-28T02:13:31Z Indexed on 2010/04/28 2:23 UTC
Read the original article Hit count: 465

I have a form with an ever-growing amount of associated javascript. At present this javascript lives in my form view which is fine, but it's getting larger and starting to overwhelm the form making it difficult to work on the form.

I want to put this in a separate file in my /public/javascripts directory but a lot of the javascript is generated by embedded ruby. This embedded ruby is ignored and passed through to the browser if I just put the code here.

What is the best way (if any) of having this embedded ruby executed and the javascript being generated in the same way as if it were in my view?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby