You can create a dynamically created Javascript view file similar to the one I show here .
Basically, if you have a controller action (for example, the action of javascripts controller stations). It might look like this.
def stations
@stations = Station.all
end
you can create a javascript view file like this ...
var stations = <%= @stations.map(&:name).to_json %>;
javascript javascript, , application.js. , javascript.
<%= javascript_include_tag 'stations' %>
, "javascripts", , javascripts. .
, Rails-, , , js-, .