I am trying to pass a ruby ββarray to a js representation (js.erb format), but it does not work at all.
var array = "<%= @publishers_list %>";
An array of variables is simply set as a string with all the array values ββin it.
Is there any way to save the format of the array?
Edit
I just realized that this is because of my array format.
[{:label => "name1", :value => value1}, {:label => "name2", :value => value2}]
I tried passing a simple array, for example:
[1,2,3]
and it worked fine.
The question now is: how can I pass this array? I really need to store these hashes in it because I want to express it as a jQuery autocomplete source.
source share