Skip to content

Commit

Permalink
Prefer family currency preference than default currenty (#755)
Browse files Browse the repository at this point in the history
  • Loading branch information
gathuku committed May 17, 2024
1 parent 45ae4a9 commit 1bbfdee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/helpers/application_form_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def money_field(method, options = {})

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,
Expand All @@ -45,7 +45,7 @@ def money_field(method, options = {})
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]) +
Expand Down

0 comments on commit 1bbfdee

Please sign in to comment.