Ask A Question

Notifications

You’re not receiving notifications from this thread.

How can you allow users (companies) in your app to select their own currency?

Viktor Smári asked in General

We use i18n and we have our app in ~5 languages, but we want the companies to be able to select which currency to use.
Mainly to choose the correct symbol to show on their invoices to their customers.
This is not an e-commerce site, so no currency conversion is needed, only displaying of currency.

Requirements:

  • In company settings, there would be box with all the available currencies from i18n or similar A company in Netherlands can have the app in English but choose the Euro currency. A company in Argentina can have the app in Spanish but use the Argentine peso (and not the Euro) We have done extensive research and found no clear answer to this. Maybe the answer is too obvious and we missed it? Related unanswered questions: https://stackoverflow.com/questions/16285677/multiple-currencies-in-rails https://stackoverflow.com/questions/36700004/ruby-on-rails-currency-switcher-for-whole-site https://stackoverflow.com/questions/58357673/how-to-allow-users-to-select-all-currencies-but-with-limited-languages https://www.reddit.com/r/rails/comments/gepybq/how_do_you_allow_users_to_select_between_multiple/ https://github.com/svenfuchs/rails-i18n/issues/874
Reply

You could add a currency field to your Company model, and allow it do be modified through the CompaniesController#edit action. This way I can have my locale as Spanish, but select any currency that I want and see that across the application.

Reply
  1. How do you generate your list of currencies? Do you use the money gem?
  2. How do you display the currency format, which helper do you use, if any?
Reply

The number_to_currency helper is useful for this and I highly recommend the money gem.

Reply
Join the discussion
Create an account Log in

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

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

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