Skip to content

Commit

Permalink
Rewrite callbacks for avoid using redirect_to :back
Browse files Browse the repository at this point in the history
* Change redirect_to to render (#2113)

* Rewrite callbacks for avoid using redirect_to :back
  • Loading branch information
Maksym committed Apr 19, 2019
1 parent a18297b commit 5cc5549
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/controllers/admin/deposits/coins_controller.rb
Expand Up @@ -27,7 +27,7 @@ def update
when 'collect_fee'
deposit.collect!
end
redirect_to :back, notice: t('admin.deposits.coins.update.notice')
redirect_to admin_deposit_index_path(currency.id), notice: 'Deposit succesfully updated.'
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/deposits/fiats_controller.rb
Expand Up @@ -35,7 +35,7 @@ def update
case params.fetch(:commit)
when 'Accept'
@deposit.charge!
flash.keep[:notice] = t('.notice')
flash.keep[:notice] = "The recharge have been successful."
when 'Reject'
@deposit.reject!
end
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/admin/withdraws/coins_controller.rb
Expand Up @@ -34,7 +34,7 @@ def update

def destroy
@withdraw.reject!
redirect_to :back, notice: t('admin.withdraws.coins.update.notice')
redirect_to admin_withdraw_path(currency.id, @withdraw.id), notice: 'Withdrawal succesfully updated.'
end

private
Expand Down Expand Up @@ -64,15 +64,15 @@ def process!
@withdraw.accept!
@withdraw.process!
end
redirect_to :back, notice: t('admin.withdraws.coins.update.notice')
redirect_to admin_withdraw_path(currency.id, @withdraw.id), notice: 'Withdrawal succesfully updated.'
end

def load!
@withdraw.transaction do
@withdraw.update!(txid: params.fetch(:txid))
@withdraw.load!
end
redirect_to :back, notice: t('admin.withdraws.coins.update.notice')
redirect_to admin_withdraw_path(currency.id, @withdraw.id), notice: 'Withdrawal succesfully updated.'
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/admin/withdraws/fiats_controller.rb
Expand Up @@ -30,12 +30,12 @@ def update
@withdraw.dispatch!
@withdraw.success!
end
redirect_to :back, notice: 'Withdraw successfully updated!'
redirect_to admin_withdraw_path(currency.id, @withdraw.id), notice: 'Withdrawal successfully updated!'
end

def destroy
@withdraw.reject!
redirect_to :back, notice: 'Withdraw successfully destroyed!'
redirect_to admin_withdraw_path(currency.id, @withdraw.id), notice: 'Withdrawal successfully destroyed!'
end
end
end
Expand Down

0 comments on commit 5cc5549

Please sign in to comment.