title: How to format a number in a ruby on rails controller, number_with_delimiter works only in views
body: <p>I would like to format a number in a controller before inserting it into a string. But the function number_with_delimiter() does not work in a controller.
  I need the string to send to a javascript plugin.</p>
  
  <p>I could run the code in the view, but I guess that is not the best option.</p>
  
  <pre><code>@mycarousel_itemList = @mycarousel_itemList + "{url: '" + p.photo.url(:thumb) + 
  "', price: '" + p.price.to_s + "&amp;nbsp;&amp;euro;'}," 
  </code></pre>
  
  <p>Is there an alternative function to change the format of p.price?</p>