1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-23 15:19:38 +02:00

Prefer family currency preference than default currenty (#755)

This commit is contained in:
Moses Gathuku 2024-05-17 16:30:01 +03:00 committed by GitHub
parent 45ae4a9737
commit 1bbfdee463
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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]) +