From 1bbfdee463bb8f6d612a4733734a57b85cf4a193 Mon Sep 17 00:00:00 2001 From: Moses Gathuku Date: Fri, 17 May 2024 16:30:01 +0300 Subject: [PATCH] Prefer family currency preference than default currenty (#755) --- app/helpers/application_form_builder.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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]) +