Kristiyan Tsvetanov Kristiyan Tsvetanov - 9 months ago 110
Ruby Question

Rails, number to currency locale

I am trying to use


However, I do not know how to pass the locale if it is a variable.

In other words,
number_to_currency(100, locale: :us)
works, but
number_to_currency(100, locale: @locale)
@locale = "us"
, does not work.


"us" is a string, you need to pass in a symbol

use @locale.to_sym