Open
Description
In the latest rails 8.0, I could not seem to change the default currency from usd
to gbp
.
Things I've tried:
# initializers/money.rb
MoneyRails.configure do |config|
config.default_currency = :gbp
# config.default_currency = -> { :gbp }
end
Have also tried, in model:
# Meal.rb
register_currency :gbp # does nothing
# with_currency does nothing
monetize :price_cents, with_currency: :gbp
In rails console
Meal.last.price.currency.name #= "United States Dollar"
A workaround was to use a callback in the model:
[...]
after_initialize do |meal|
self.price_currency = Money::Currency.new(:gbp)
# If we kept register_currency :gbp, we could do:
# self.price_currency = Meal.currency
end
Nothing actually works as per documentation. Has this issue been addressed, but not reflect on the documentation?
Thanks
Metadata
Metadata
Assignees
Labels
No labels