I want to POST a data as JSON to the controller
in javascript, the data is an array, for example, a = [1,2]
then I POST, say
$.post('user/data', {'data' : a})
in the user controller, I get the data from params.
However, when I retrieve params[:data], I got a hash:
{"0"=>1, "1"=>2}
rather then an array!
so I have to convert the hash into an array manually.
Is there a method to pass the exact array to the controller?