I'm wondering what the best practice is for passing variables to JavaScript functions in a rails view. Right now I'm doing something like:
<% content_for :javascript do %>
<script type="text/javascript">
Event.observe(window, 'load', function(){
js_function(<%= @ruby_array.to_json %>, <%= @ruby_var %>); )}
</script>
<% end %>
Is this the right way to go about it?