I have a Ruby array with account ids.
I would like to store the Ruby array of account ids in a Javascript array.
I was wondering the best way to do this?
In addition, when I’ve been trying to do this it seems that Javascript think if there is only one account id entered then that should be the size of the array. Is there a way around this? I’ve tried putting it in quotes but that does not seem to work.
Let’s assume you are using erb. A first approach:
The problem is that this creates a global variable without context (who uses it?). That’s why I’d rather call a function defined somewhere in your JS code: