2

I have some amount in numeric for e.g 75.00 and I am trying to convert it into words, for that I used humanize

75.humanize

But it keeps throwing error "undefined method humanize error for 75:Float"

Shilpi Agrawal
  • 67
  • 1
  • 12

1 Answers1

1

Make sure you have installed humanize gem

Now you can convert number to words

2.humanize     #=> "two"
4.humanize     #=> "four"
8.humanize     #=> "eight"

75.humanize    #=> "seventy-five" 
75.0.humanize  #=> "seventy-five point zero" 
75.00.humanize #=> "seventy-five point zero" 

NOTE: Rails also has a humanize method in string class which works differently

Deepak Mahakale
  • 22,834
  • 10
  • 68
  • 88