Handling multiple-currencies - advice/comments please

Hi all,

I want to create a site which can handle prices in multiple currencies.
At the moment this is restricted to US Dollars, Euro and Pounds
I’m in the UK, so all products would be stored in Pounds Sterling. At
this point in time there is no need for internationalisation or
localisation. We’re just interested in letting the user work in their
native currency.

I’ve seen the dollars and cents plugin, and also the use of aggregation
create a composite Money class which goes a long way to achieving what I
might need… Has anyone been here before and got any advice or
for me? - I’m particularly interested in being able to maintain the
ability to do math operations in the database (for reporting etc.) and
also handling currency symbols appearing before or after the amount, as
the case in some currencies.

My current train of thought is to store prices as INTs (in pence
and have a table of currencies containing something like this:
id, name, symbol, symbol_before (Y or N, N assumes symbol comes after
value) and sterling_exchange_rate.

We would default to pounds sterling and store the currency object in the
session. A Money class would handle the aggregation and conversion
by referencing the currency object in the session.

Does this sound like a sensible plan?

Many thanks in advance,


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs