KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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. I could run the code in the view, but I guess that is not the best option. @mycarousel_itemList = @mycarousel_itemList + "{url: '" + p.photo.url(:thumb) + "', price: '" + p.price.to_s + " €'}," Is there an alternative function to change the format of p.price?
Tags (comma-separated)
Save Edits
Cancel