I have a model in my rails 4 app called funding.
I am using Money Rails to handle money/currency components - https://github.com/RubyMoney/money-rails
My funding model has 3 funding attributes called amount_expenses, amount_honorarium and amount_principal_financing.
The funding model also has a currency attribute for the user creating the instance to choose which currency should be used for each of the three funding attributes.
When I ran a migration to add_monetize to each of the three funding attributes, it created three corresponding currency attributes.
Do I need them? Can I ask the user to select a currency once per instance and then save the three funding attributes using that currency? How would that work? If I just have one currency attribute in the funding table, will monetise know how to choose that to display the three funding amounts?
The funding table has:
t.boolean "expenses"
t.boolean "honorarium"
t.boolean "financing"
t.string "currency"
t.string "size"
t.integer "amount_expenses"
t.integer "amount_honorarium"
t.integer "amount_principal_financing"
t.float "return_on_finance"
t.integer "period_of_return"
t.text "expense_description"
t.integer "scope_id"
t.integer "amount_expenses_pennies", default: 0, null: false
t.string "amount_expenses_currency", default: "GBP", null: false
t.integer "amount_honorarium_pennies", default: 0, null: false
t.string "amount_honorarium_currency", default: "GBP", null: false
t.integer "amount_principal_financing_pennies", default: 0, null: false
t.string "amount_principal_financing_currency", default: "GBP", null: false
end
Thank you