mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-02 20:15:22 +02:00
Integrate money-rails gem (#268)
* Integrate money-rails gem * Fix Lint issues * Basic test for monetize feature * Merge main branch * Changes to monetize balance field --------- Co-authored-by: Zach Gollwitzer <zach.gollwitzer@gmail.com>
This commit is contained in:
parent
323a8ccf50
commit
1182ab39bd
12 changed files with 176 additions and 14 deletions
14
db/migrate/20240206031739_replace_money_field.rb
Normal file
14
db/migrate/20240206031739_replace_money_field.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
class ReplaceMoneyField < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_monetize :accounts, :balance
|
||||
change_column :accounts, :balance_cents, :integer, limit: 8
|
||||
|
||||
Account.reset_column_information
|
||||
|
||||
Account.find_each do |account|
|
||||
account.update_columns(balance_cents: Money.from_amount(account.balance, account.currency).cents)
|
||||
end
|
||||
|
||||
remove_column :accounts, :balance
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue