Money-Rails not formatting thousands correctly for salaries

264 Views Asked by At

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"
1

There are 1 best solutions below

0
mmsilviu On

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: