Method to Prevent ' from turning into "
ruby-on-rails, ruby-on-rails-3, ruby-on-rails-3.2
Solution
I ended up using: `data: <%= @product_count.to_json.html_safe %>`
I tried both `h` and `raw` and neither of those worked, however, `html_safe` did it.
Not sure why, but for future travelers I'm on rails version 3.2.7.
Problem
I have the following line: ``` data: <%= @product_count.to_json %> ``` which renders: ``` data: [["name1",20], ["name2",9], ["name3",18], ["name4",32], ["name5",28], ["name6",17], ["name7",11]] ``` in the view. How do I change this so I get the actual quotes instead of the HTML. The data comes from this line: ``` period_registration_product.each do |key, value| @product_count << [Product.find_by_id(key).name, value] end ``` Update: I tried: `data: <%= JSON.parse(@product_count.to_json) %>` and it failed.