diff --git a/lib/spree/money_decorator.rb b/lib/spree/money_decorator.rb index fc249151f4..755041df0e 100644 --- a/lib/spree/money_decorator.rb +++ b/lib/spree/money_decorator.rb @@ -9,4 +9,15 @@ Spree::Money.class_eval do @options[:no_cents] = true if @money.dollars % 1 == 0 to_s end + + def to_html(options = { :html => true }) + output = @money.format(@options.merge(options)) + if options[:html] + # 1) prevent blank, breaking spaces + # 2) prevent escaping of HTML character entities + output = output.sub(" ", " ").html_safe + end + output + end + end