In layout paste:
return_jsvars('var Application.config')Then anywhere in views:
add_jsvars({:url => {:port => 80}})
...
add_jsvars({:url => {:hostname => 'localhost'}})And you will get:
<script>
var Application.config = {url: {hostname: 'localhost', :port => 80}};
</script>Copyright (c) 2011 Dmitry A. Ilyashevich, released under the MIT license