Closed laptopmutia closed 1 year ago
so I have a transaction model and in this Active Records model I have column that hold, currency buying_price and selling_price
buying_price
selling_price
I want to use the exchange rates using this two column, is that possible?
because from the docs money have a complicated exchange rates, it stores the exchange rates in a global/gem config instead per model
money
here is my schema
create_table "bills", force: :cascade do |t| t.decimal "selling_currency_rate", default: "0.0", null: false t.decimal "buying_currency_rate", default: "0.0", null: false t.bigint "foreign_currency_id" t.decimal "total_amount" end
the default or local currency is always IDR
IDR
One way to get the current exchange rate could be to determine it on the spot. E.g.: 1.to_money("EUR") / 1.to_money("IDR").
1.to_money("EUR") / 1.to_money("IDR")
so I have a transaction model and in this Active Records model I have column that hold, currency
buying_price
andselling_price
I want to use the exchange rates using this two column, is that possible?
because from the docs
money
have a complicated exchange rates, it stores the exchange rates in a global/gem config instead per modelhere is my schema
the default or local currency is always
IDR