Files
sure/app/controllers/goals_controller.rb
Guillem Arias Fauste 6a89efb9c9 fix(goals): default goal currency so it survives a failed create (#2171)
When a new goal failed server-side validation (e.g. no funding account
selected), the currency was never assigned — `goal_params` doesn't permit
`:currency` and it was only derived from the first linked account. On the
re-rendered form the money field fell back to its USD default, so a CHF
(or any non-USD) family saw their target amount silently reset to dollars,
and a spurious "Currency must be filled" error appeared on a field the
user can't even set.

Always default the currency to the first linked account's currency when
present, otherwise the family's primary currency. Currency is now never
blank, so the derived-field error never surfaces and the money field keeps
the family currency across a failed submit.

Fixes we-promise/sure#2170
2026-06-04 11:57:16 +02:00

10 KiB