From 78788ad72390806803adf38d8847fd0c858154f6 Mon Sep 17 00:00:00 2001 From: Gaurish Sharma Date: Sat, 19 Jul 2014 20:06:59 +0530 Subject: Performed Returns true if redirect/render has happened --- actionpack/lib/action_controller/metal.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb index 9a427ebfdb..0fa0357bae 100644 --- a/actionpack/lib/action_controller/metal.rb +++ b/actionpack/lib/action_controller/metal.rb @@ -182,7 +182,10 @@ module ActionController body = [body] unless body.nil? || body.respond_to?(:each) super end - + + # Tests if render or redirect already happended. Could be useful when used as a + # conditional to return early out a controller action to avoid AbstractController::DoubleRenderError + # example in case of multiple render/redirects in single controller action def performed? response_body || (response && response.committed?) end -- cgit v1.2.3