njmacinnes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Apr-17 15:02 UTC
handling currencies
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
njmacinnes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Apr-17 15:11 UTC
Re: handling currencies
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 On 17/04/07, njmacinnes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <njmacinnes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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 >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---