ruby variable and java script array?

Lalala Liliil wrote:

Hi everyone,
I am in a situation where I have a ruby var x and I like to pass that
var x to javascript array at index x
Is there a way of doing such a thing?

Is this supposed to happen when the page loads or during some sort of browser event when the user is viewing the page? If it's on page load you can just write some ERb in the .rhtml file to pass the value of the ruby var into the JavaScript array. If it's on a browser event and you want the value to be set without a page refresh you can use Ajax.