Reputation: 8172
im using the Ruby money gem to display currency in my app. I need to add the currency and the decimal sperately like this :
<p class="pricing-rate"><sup>$</sup> <%= package.price %> <span>.00</span></p>
So it will look like the image I attached. How can I do this?
Upvotes: 0
Views: 148
Reputation: 4009
The easiest way would be to convert it to string and split on .
<% price = package.price.to_s.split('.') %>
<p class="pricing-rate"><sup>$</sup> <%= price[0] %> <span>.<%= price[1] %></span></p>
Upvotes: 1