What is the best way to add JavaScript to my Rails3 views?
I would like to be able to do some processing in a controller, then craft some JavaScript based on the result and put the resulting JavaScript in a view.
For example, I would like to get a series of lat/lng points from a database and create markers on a Google Map. The map initialization and markers must be created in JavaScript, but interact with the view. (This is just one example of what I am trying to accomplish. I am not looking for recommendations of gems/plugins that do Google Maps integration).
Is there some way to render an js.erb file into the head of a particular view? What is the "rails way" of doing this sort of thing?