0

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

1 回答 1

0

默认情况下,money 对象的金额以美分为单位。因此,您需要在保存或设置值时考虑到这一点。

您可以在此答案中找到更多详细信息。进行格式化的一些选项:

于 2018-03-05T08:30:54.270 回答