From d25847571fddddd185d3f57b24fe479030b6dac9 Mon Sep 17 00:00:00 2001 From: dinsmol Date: Mon, 23 Aug 2021 16:38:44 +0300 Subject: [PATCH] fixed codeclimate errors --- app/controllers/admin/accounts_controller.rb | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/app/controllers/admin/accounts_controller.rb b/app/controllers/admin/accounts_controller.rb index a749f948f..6dc6d9f5e 100644 --- a/app/controllers/admin/accounts_controller.rb +++ b/app/controllers/admin/accounts_controller.rb @@ -17,19 +17,12 @@ module Admin def update if @account.valid? @sum = params[:account][:balance].to_f - @account.balance - action = Actions::AccountActivityCreate.new(@account, - @sum, - params[:description], + action = Actions::AccountActivityCreate.new(@account, @sum, params[:description], AccountActivity::UPDATE_CREDIT) - - unless action.call - handle_errors(@account) - render 'edit' - end - redirect_to admin_accounts_path, notice: t('.updated') - else - render 'edit' + redirect_to admin_accounts_path, notice: t('.updated') if action.call end + + render 'edit' end private