lib/money-rails/mongoid/money.rb in money-rails-1.6.2 vs lib/money-rails/mongoid/money.rb in money-rails-1.7.0
- old
+ new
@@ -35,9 +35,10 @@
object.deep_symbolize_keys!
elsif object.respond_to?(:symbolize_keys!)
object.symbolize_keys!
end
::Money.new(object[:cents], object[:currency_iso]).mongoize
+ when object.nil? then nil
when object.respond_to?(:to_money) then
begin
object.to_money.mongoize
rescue ArgumentError, Money::Currency::UnknownCurrency
raise if MoneyRails.raise_error_on_money_parsing