master
Library for dealing with money and currency conversion — Read more
It's not true, but it works :)
require 'money' class Money include ActionView::Helpers::NumberHelper def to_s number_with_delimiter( sprintf("%.2f", cents / 100.00), I18n.translate(:'number.format.separator'), I18n.translate(:'number.format.delimiter') ) end end
line 75, it tries to round cents whether or not it is nil (which actually doesn't break any of the rest of your code)
everything irons out if you follow it with an: if cents
I have the same problem but it seems to work if you add :allow_nil in your model.
composed_of :price, :class_name => "Money", :mapping => [%w(cents cents), %w(currency currency)], :allow_nil => true