Consider an integer number @num = 27565
. I want to display it as 27,000
I tried this in my rails console:
number_with_delimiter(12345678) # => 12,345,678
But I am getting this error:
NoMethodError: undefined method `number_with_delimiter' for main:Object
Some of the examples are:
12345678 # => 12,000,000
27565 # => 27,000
UPDATE
The NoMethodError
was fixed by following:
How to use all view and helper methods inside of Rails console for Rails 2.x and 3.x?
But my second question, i.e how to add zeros after first comma, was not answered.