Johnny C
Johnny C

Reputation: 131

Money-Rails not formatting thousands correctly for salaries

When I use money-rails for converting the integer hourly_wage_salary_cents column into a thousands money object. It removes 2 zeros from the number itself. Instead of getting $50,000, I am getting $500.00 or $500. How can I format the money object to include the correct comma places for numbers larger than hundreds.

show.html.erb

<h6><%= fa_icon 'money' %> Salary/Wage</h6>
        <p>
          <%= money_without_cents @job.hourly_wage_salary_cents %>
        </p>

job model

monetize :hourly_wage_salary, :as => "hourly_wage_salary_cents"

Upvotes: 0

Views: 276

Answers (1)

mmsilviu
mmsilviu

Reputation: 1451

By default the money object will have the amount in cents. So, you need to take this in account when saving or setting the value.

You can find more details in this answer. Some options to do the formatting:

Upvotes: 0

Related Questions