2

i'm using rails 3.2 and ruby 1.9.3 i'm using this to display a price:

number_to_currency(12.0)

in locale :en, it works but in :es I get: comparison of String with 0 failed

didn't find it anywhere, anyone?

edit: I have updated the number just to be clear, the number is legal, the problem is with the locale

devmonster
  • 323
  • 2
  • 12
  • checkout this http://stackoverflow.com/questions/10842529/number-with-precision-return-integer. Also do check the return value's class of order[:base_price], '1' > 0 would fail with the error: comparison of String with 0 failed – dotcomXY Aug 12 '13 at 09:21

2 Answers2

3

There can be another explanation to this error when the locale file actually exists.

Make sure that numbers are not quoted in your locale file.

i.e.

es:
  number:
    currency:
      precision: 2    # correct
      precision: "2"  # that would be wrong
Michał Szajbe
  • 8,830
  • 3
  • 33
  • 39
1

Possible duplicated question with this one number_to_currency locale converting

Try adds the es.yml in your locale and try again.

Community
  • 1
  • 1
dotcomXY
  • 1,586
  • 1
  • 15
  • 18