3

I am having difficulties to change the symbol position from "$ 100.00" to "100.00 $" in Solidus 2.0.0

I overided app/lib/spree/money.rb and I have added this line for

 self.default_formatting_rules = {
 symbol_position: :after }

and basically when I am testing the code below its working :

pry(main)> ::Money.default_formatting_rules = { symbol_position: :after }
  => {:symbol_position=>:after}
[2] pry(main)> Spree::Money.new(100).to_s
  => "100.00 $"

But in my view it still showing the price as "$ 100.00", do you have any idea where this could come from ? I would greatly apreciate your help.

Thanks a lot.

EDIT : Find the answer

Actually the file money.rb is a gem file so it can not be overwritten (from what i understand) so i created

/config/initializers/money_new_and_formatting.rb

Spree::Money.default_formatting_rules[:symbol_position] = :after

So its loading all the gem and environment and then Im accessing the Money class via the initializer folder and modifying the format.

Cheers.

Jonathan Chevalier
  • 993
  • 1
  • 9
  • 18

0 Answers0