@Ahmed-Moataz  "redirect_to :back" is written in both clauses of if statement.