All threads / Changing currency
Ask A Question

Notifications

You’re not receiving notifications from this thread.

Changing currency

Alan Reid asked in Rails

I would like to change the currency in my app for each site.

So i currently have number_to_currency(aNumber, :locale => :gb) which works well. I have a number of sites which use different currencies and have their country set in @sites.currency - this passes in gb, eu, us, vi for example.

How would i go about changing the :locale => :fr to :locale => :gb as currently i can only get it passing in as a string, which is not obviously valid.

@sites.currency.to_sym should work. 👍

@sites.currency.downcase.to_sym worked a treat buddy, thanks :)

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 61,501+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2022 GoRails, LLC. All rights reserved.