From f04a8bc76bb310342c3e51708bcdd70fe4095d4a Mon Sep 17 00:00:00 2001 From: peterrobert Date: Tue, 23 Jun 2020 16:47:01 +0300 Subject: [PATCH] fixed the redirect bug in transaction --- app/controllers/transactions_controller.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/transactions_controller.rb b/app/controllers/transactions_controller.rb index 4fa8aed..3feb183 100644 --- a/app/controllers/transactions_controller.rb +++ b/app/controllers/transactions_controller.rb @@ -50,8 +50,15 @@ def edit def update @transaction = current_user.transactions.find(params[:id]) if @transaction.update(transaction_params) + + if @transaction.group_id.nil? - redirect_to transactions_path, notice: 'transaction was successfully updated.' + redirect_to external_path, notice: 'external transaction was successfully updated.' + else + redirect_to transactions_path, notice: 'transaction was successfully updated.' + end + + else render :edit end