So im getting an array from parameters(JS)
"[[\"01000290056001\",0],[\"01000290056002\",0]]"
The problem is in quotes that are at the start and at the end, ruby reads this not as array but as string.
Here is the screenshot with parametres that I get from JS (http://prntscr.com/p8fagj)
JS that is used
$('.button').bind("click", function() {
var ar_id = $(this).attr("testval");
collectID = $('input[checked]:not(:checked), input:not([checked]):checked')
.map( ( _, it ) => [[ it.value, it.checked ? 1 : 0 ]] )
.get()
$.get('/places/call_this',
{
cad_ids: JSON.stringify(collectID),
ar_id: ar_id
},
function(response) {
// nothing here
}
);
})
The question is how to correctly pass the array to Ruby Controller without quotes? Or how to remove them in the controller directly?
So in the end, I need something like this
[["01000290056001",0],["01000290056002",0]]
It will be used for .each function.