Reputation: 131
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
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:
number_to_currency
from ActionView::Helpers::NumberHelperhumanized_money @money_object
from money_rails
helpersUpvotes: 0