Forum: Ruby on Rails handling currencies

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D5145c421cd25af6fa577c15219add90?d=identicon&s=25 unknown (Guest)
on 2007-04-17 17:03
(Received via mailing list)
Hi
How should I handle storing money in different currencies in my
database.
I'm using the money gem (although I can change that if anyone thinks of
a
better way), but when items are based in different countries, I'll want
to
give them different currencies.

One solution I thought of is to store everything in a primary currency
(£,
because I'm patriotic), and convert as necessary. This would mean
setting
the conversion rates based on the number of decimal places each currency
has. So £ - $ and £ - € would be 1, whereas £ - ¥ would be 100. This
seems
like a fairly good solution, with just a small odour of hackiness. Does
anyone have any better ideas?
-Nathan
D5145c421cd25af6fa577c15219add90?d=identicon&s=25 unknown (Guest)
on 2007-04-17 17:12
(Received via mailing list)
Oh dear. Now I look silly for not reading things through. The money gem
supports storing multiple currencies in the database. Sorry to clog up
the
list.
-N
This topic is locked and can not be replied to.