Update agents_controller.rb

"@agent.destroyed?" is more simple and obvious than "message.include?("deleted")"

KimJungHun 10 年之前
父節點
當前提交
b939a27526
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      app/controllers/agents_controller.rb

+ 1 - 1
app/controllers/agents_controller.rb

@@ -179,7 +179,7 @@ class AgentsController < ApplicationController
179 179
 
180 180
   # Sanitize params[:return] to prevent open redirect attacks, a common security issue.
181 181
   def redirect_back(message)
182
-    if params[:return] == "show" && message.include?("deleted")
182
+    if params[:return] == "show" && @agent.destroyed?
183 183
       path = agents_path
184 184
     elsif params[:return] == "show" && @agent
185 185
       path = agent_path(@agent)