Number with delimiter in JavaScript
I have a form with figures that can be altered anytime. When numbers are changed, calculations are made with JavaScript to keep statistics current. The problem was, that the stats were first set server-side by the convenient NumberHelper#number_with_delimiter helper method that is provided by Rails, but when new calculations were made client-side, the pretty formatting was destroyed.
The solution was to shamelessly grab the number_with_delimiter logic and put it into a JavaScript function (a bit simplified).
Now I just have to run the new numbers through number_with_delimiter before updating the stats.
Comments [1]