my google pie chart code is
var data = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
["Work", 50],
["Eat", 20],
["Commute", 20],
["Watch TV", 5],
["Sleep", 5]
]);
and my code is (<%= @datas.map { |d| [d.name, d.value] }.inspect %>)
which gives the result
([["apple", "10"], ["orange", 20], ["banana", 30], ["grapes", 80], ["papaya", 44]])
when i put this result in my google pie chart code directly like this
var data = google.visualization.arrayToDataTable([["apple", "10"], ["orange", 20], ["banana", 30], ["grapes", 80], ["papaya", 44]])
then it works perfectly. But keeping directly
var data = google.visualization.arrayToDataTable(<%= @datas.map { |d| [d.name, d.value] }.inspect %>)
does not work. What could be the reason behind this. Do ruby code have some formate to keep inside Or where i am doing wrong?