diff --git a/app/controllers/goals_controller.rb b/app/controllers/goals_controller.rb index 7406f8fe4..1bb8f3c8a 100644 --- a/app/controllers/goals_controller.rb +++ b/app/controllers/goals_controller.rb @@ -61,7 +61,7 @@ class GoalsController < ApplicationController def create @goal = Current.family.goals.new(goal_params) accounts = lookup_accounts(params.dig(:goal, :account_ids)) - @goal.currency = accounts.first.currency if accounts.any? && @goal.currency.blank? + @goal.currency = (accounts.first&.currency || Current.family.primary_currency_code) if @goal.currency.blank? Goal.transaction do accounts.each { |a| @goal.goal_accounts.build(account: a) }