Create application.js.erb and put it in views/js/ then you render :partial => 'js/application.js.erb', :locals => {:data => @your_data}
and use variable 'data' in your partial like <script> var foo = <%= data[:foo]%> </script> On Sat, Apr 17, 2010 at 2:13 AM, Jose <joloh...@me.com> wrote: > How can I get rails to process and serve application.js.erb instead of > application.js? > > I want to mix Ruby and Javascript code in the file. I am building > Javascript arrays from data that i keep in a Rails model and the > arrays are static. > > -- > 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 rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com<rubyonrails-talk%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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 rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.