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(-) (limited to 'actionpack/lib/action_controller') 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 From d9bd75a0d85355b8d63e4003a76c6399f0dbce17 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sat, 2 Aug 2014 12:05:26 +0000 Subject: copy edits[ci skip] --- actionpack/lib/action_controller/metal.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb index 0fa0357bae..bfbc15a901 100644 --- a/actionpack/lib/action_controller/metal.rb +++ b/actionpack/lib/action_controller/metal.rb @@ -183,9 +183,7 @@ module ActionController 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 + # Tests if render or redirect has already happened. def performed? response_body || (response && response.committed?) end -- cgit v1.2.3