A
A
Alexander Petrov2015-10-28 12:04:55
Ruby on Rails
Alexander Petrov, 2015-10-28 12:04:55

How to put spaces in ruby?

I have a price for a house, for example: 1616900 r.
the number 1616900 is recorded in the database as an integer.
How can I convert it to this format: 1 616 900 ?
That is, put spaces in thousandths?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey R, 2015-10-28
@Mirkom63

Helper can be usednumber_with_delimiter(1616900, delimiter: " ")

Z
Z0nd0R, 2015-10-31
@Z0nd0R

To display the currency there is a number_to_currency helper

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question