Here are all the Rails 4 (ActiveRecord migration) datatypes:
:binary
:boolean
:date
:datetime
:decimal
:float
:integer
:primary_key
:references
:string
:text
:time
:timestamp
Source: Rails 4: List of available datatypes
As you can see there is no data type currency. I suggest you to create a decimal column for the amount and an integer for the currency.
Why integer? Well because you can set an enum for that column in your model like this:
enum currency: [:dollar]
This creates a method with the same name as the enum, so let's say you have a cost variable:
cost.dollar?
This will return true or false depending on the value.
Also with this you can easily create some case to make all the changes in currency you like:
case cost.currency
when Cost.currencies[:dollar]
# Do something
end
Always compare this column with Cost.currencies[:symbol_of_currency] instead of the number (enums work just like C, 0 would be the first element), this will allow you to change the order of the elements inside the enum or add new ones without changing the functionality of your app.
Also, this allows you to create the rows in the database like this:
Cost.create(currency: :dollar, amount: 30.0, ...)