Skip to content

armgit / maybe

Public Imported from GitHub
0

The personal finance app for everyone

Prefer family currency preference than default currenty (#755)

Moses Gathuku1bbfdee463bb
diff --git a/app/helpers/application_form_builder.rb b/app/helpers/application_form_builder.rb
index 0bdf3fab..3292a1c6 100644
--- a/app/helpers/application_form_builder.rb
+++ b/app/helpers/application_form_builder.rb
@@ -33,7 +33,7 @@ class ApplicationFormBuilder < ActionView::Helpers::FormBuilder
readonly_currency = options[:readonly_currency] || false
- currency = money&.currency || Money.default_currency
+ currency = money&.currency || Money::Currency.new(Current.family.currency) || Money.default_currency
default_options = {
class: "form-field__input",
value: money&.amount,
@@ -45,7 +45,7 @@ class ApplicationFormBuilder < ActionView::Helpers::FormBuilder
merged_options = default_options.merge(options)
grouped_options = currency_options_for_select
- selected_currency = money&.currency&.iso_code
+ selected_currency = money&.currency&.iso_code || currency.iso_code
@template.form_field_tag data: { controller: "money-field" } do
(label(method, *label_args(options)).to_s if options[:label]) +