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 33,665+ 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.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.