title: Rails 3 passing a rails array to javascript function which uses a javascript array
body: <p>I am trying to pass a rails array to a javascript function.  The function will then use the array values in javascript so I need to keep it an array.  </p>
  
  <p>Here is how I am passing my array:</p>
  
  <pre><code>"graphit([&lt;%=@mpg_values.join(",") %&gt;])"
  </code></pre>
  
  <p>This produces this in the HTML</p>
  
  <pre><code>"graphit([#&amp;lt;Mile:0x6ff0cf0&amp;gt;,#&amp;lt;Mile:0x6ff0c18&amp;gt;,#&amp;lt;Mile:0x6ff0b58&amp;gt;])"
  </code></pre>
  
  <p>Which are not the values, they should be decimal numbers.  I assume this is because it is a reference to the array so that I why I am getting the messed up values.  If I do something like to_s I see the values but it has other stuff like the table and filed name in there as well.</p>
  
  <p>Anybody know how I can get this rails array to a javascript function as an array?</p>
  
  <p>Thanks in advance for any help.</p>