0

Why does this work:

    var data_array = [["name", "value"], ["osnadosd", 25]]
    var data = new google.visualization.arrayToDataTable(data_array, false);

And this doesn't:

    var data_array = <%= make_a_chart(@db_call.results) %>
    var data = new google.visualization.arrayToDataTable(data_array, false);

when make_a_chart(@db_call.results) returns [["name", "value"], ["osnadosd", 25]]

delisdeli
  • 839
  • 9
  • 20

1 Answers1

0

The value that make_a_chart(@db_call.results) is returning is not html safe. To correct this simply append .html_safe to the value you are returning if it is a string, and otherwise convert it to a string then make it html safe: toReturn.to_s.html_safe.

delisdeli
  • 839
  • 9
  • 20