Rails 3 - Query result to Map for jQuery Array

I'm sure this is a stupid bug that I'm missing but I can't seem to get past this issue. I have a Query that selects two values Status and Count of items in that status. Query works fine it is mapping these results into a jQuery data: block. Here is what I have

This works

 data: [
           <% count_by_status.each do |c| %>
               ["<%= c[0] %>",<%= c[1] %>],
           <% end %>

This does not because the " " around status is turning into &quot;

<%=  count_by_status.map{|status, count| [status, count.to_i] }.inspect %>

I'm sure it is a stupid error but if anyone can help. I have tried .html_safe, different formats..etc and it just keeps failing.

The ugly code works but the clean nice code doesn't..argh

UPDATED Still not sure why this works and the other actually escapes the code but this one works now

<%=  raw count_by_status.map{|status, count| [status, count.to_i] }.inspect %>


Rails 3 escapes HTML unless you use pass it to the raw method or call the string's html_safe method.

Need Your Help

Can't post blank to database: postgreSQL and Codeigniter

php codeigniter postgresql

In my View Page, I have a blank input but whenever I have to post to my database, it gets error.

ERROR: Currently 'rvm docs …' does not work with non-rvm rubies

ruby osx rvm

I'm just starting to learn ruby/rails and I have followed the instructions to install ruby on OSX lion from pragmaticstudio.com

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.