mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-04 21:15:19 +02:00
Migrate valuations controller to new reconciliation methods
This commit is contained in:
parent
25f0c78c47
commit
d80cb9f812
19 changed files with 187 additions and 171 deletions
|
@ -9,4 +9,31 @@ class CreditCardsController < ApplicationController
|
|||
:annual_fee,
|
||||
:expiration_date
|
||||
)
|
||||
|
||||
def update
|
||||
form = Account::OverviewForm.new(
|
||||
account: @account,
|
||||
name: account_params[:name],
|
||||
currency: account_params[:currency],
|
||||
current_balance: account_params[:balance],
|
||||
current_cash_balance: @account.depository? ? account_params[:balance] : "0"
|
||||
)
|
||||
|
||||
result = form.save
|
||||
|
||||
if result.success?
|
||||
# Update credit card-specific attributes
|
||||
if account_params[:accountable_attributes].present?
|
||||
@account.credit_card.update!(account_params[:accountable_attributes])
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_back_or_to account_path(@account), notice: "Credit card account updated" }
|
||||
format.turbo_stream { stream_redirect_to account_path(@account), notice: "Credit card account updated" }
|
||||
end
|
||||
else
|
||||
@error_message = result.error || "Unable to update account details."
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue