diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb
index 9eaada46..4f4c2b1e 100644
--- a/app/controllers/accounts_controller.rb
+++ b/app/controllers/accounts_controller.rb
@@ -23,10 +23,7 @@ class AccountsController < ApplicationController
end
def new
- @account = Account.new(
- balance: nil,
- accountable: Accountable.from_type(params[:type])&.new
- )
+ @account = Account.new(accountable: Accountable.from_type(params[:type])&.new)
if params[:institution_id]
@account.institution = Current.family.institutions.find_by(id: params[:institution_id])
diff --git a/app/helpers/forms_helper.rb b/app/helpers/forms_helper.rb
index 356f928c..0d2fe24c 100644
--- a/app/helpers/forms_helper.rb
+++ b/app/helpers/forms_helper.rb
@@ -25,6 +25,7 @@ module FormsHelper
render partial: "shared/money_field", locals: {
form: form,
money_method: money_method,
+ default_currency: options[:default_currency] || "USD",
disable_currency: options[:disable_currency] || false,
hide_currency: options[:hide_currency] || false,
label: options[:label] || "Amount"
diff --git a/app/views/accounts/edit.html.erb b/app/views/accounts/edit.html.erb
index 0b14157e..77b03030 100644
--- a/app/views/accounts/edit.html.erb
+++ b/app/views/accounts/edit.html.erb
@@ -7,7 +7,7 @@
<%= styled_form_with model: @account, class: "space-y-4", data: { turbo_frame: "_top" } do |f| %>
<%= f.text_field :name, label: t(".name") %>
- <%= money_with_currency_field f, :balance_money, label: t(".balance"), disable_currency: true %>
+ <%= money_with_currency_field f, :balance_money, label: t(".balance"), default_currency: @account.currency, disable_currency: true %>
<%= f.collection_select :institution_id, Current.family.institutions.alphabetically, :id, :name, { include_blank: t(".ungrouped"), label: t(".institution") } %>
diff --git a/app/views/accounts/new.html.erb b/app/views/accounts/new.html.erb
index 04590414..ff011fc7 100644
--- a/app/views/accounts/new.html.erb
+++ b/app/views/accounts/new.html.erb
@@ -79,7 +79,7 @@
<%= f.text_field :name, placeholder: t(".name.placeholder"), required: "required", label: t(".name.label"), autofocus: true %>
<%= f.collection_select :institution_id, Current.family.institutions.alphabetically, :id, :name, { include_blank: t(".ungrouped"), label: t(".institution") } %>
<%= render "accounts/accountables/#{permitted_accountable_partial(@account.accountable_type)}", f: f %>
- <%= money_with_currency_field f, :balance_money, label: t(".balance"), required: "required" %>
+ <%= money_with_currency_field f, :balance_money, label: t(".balance"), required: "required", default_currency: Current.family.currency %>
<%= check_box_tag :add_start_values, class: "maybe-checkbox maybe-checkbox--light peer mb-1" %>
diff --git a/app/views/shared/_money_field.html.erb b/app/views/shared/_money_field.html.erb
index 7b3288b0..fc662791 100644
--- a/app/views/shared/_money_field.html.erb
+++ b/app/views/shared/_money_field.html.erb
@@ -1,16 +1,19 @@
-<%# locals: (form:, money_method:, default_currency: "USD", disable_currency: false, hide_currency: false, label: nil) %>
+<%# locals: (form:, money_method:, default_currency:, disable_currency: false, hide_currency: false, label: nil) %>
+
<% fallback_label = t(".money-label") %>
+<% currency = form.object.send(money_method)&.currency || Money::Currency.new(default_currency) %>
+