This is what i used to do in html.erb earlier:
my markup
<script type="text/javascript">
var somevalueFromInstance = "<%= @value_from_instance %>";
// code directly using the someValueFromInstance
</script>
markup continues..
mostly i will place the script tag in a content_for block.
Now when i want to do this unobtrusive, i cannot have any script tags in the html.erb. The script lies in a javascript file. But how do i transport the @value_from_instance to the javascript file?
Is storing it in a data-attribute the only option to do this?
Also i want to do this on page load and not in an ajax request for this purpose