Beginner
Beginner

Reputation: 25

Rails how to make a number (3) to a variable (three)?

I am trying to create some javascript links.

I need to transform the ID of a object to a variable.

For example:

Company.id = 3 

I want to transform the ID to a variable like three in the view.

Upvotes: 0

Views: 83

Answers (1)

Justin Niessner
Justin Niessner

Reputation: 245429

Your best bet would be to use the functionality provided by the Ruby Linguistics Project:

English - Ruby Linguistics

companyLinkValue = Company.id.en.numwords

Upvotes: 3

Related Questions