The personal finance app for everyone (by everyone)
Ruby
Skip unnecessary sync when account balance unchanged on update (#1040)
Jeff Rowbergb1b2793e43e9
diff --git a/app/controllers/concerns/accountable_resource.rb b/app/controllers/concerns/accountable_resource.rbindex 1b8bbf6d23..007a5f33a9 100644--- a/app/controllers/concerns/accountable_resource.rb+++ b/app/controllers/concerns/accountable_resource.rb@@ -41,15 +41,14 @@ module AccountableResourceenddef update- # Handle balance update if provided- if account_params[:balance].present?+ # Handle balance update if the value actually changed+ if account_params[:balance].present? && account_params[:balance].to_d != @account.balanceresult = @account.set_current_balance(account_params[:balance].to_d)unless result.success?@error_message = result.error_messagerender :edit, status: :unprocessable_entityreturnend- @account.sync_laterend# Update remaining account attributes