aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorGaurish Sharma <contact@gaurishsharma.com>2014-07-19 20:06:59 +0530
committerGaurish Sharma <contact@gaurishsharma.com>2014-07-19 20:06:59 +0530
commit78788ad72390806803adf38d8847fd0c858154f6 (patch)
tree8be93a879bf297899bd8243a5628fc0af06976ed /actionpack/lib/action_controller
parent59b93dfda7def9e949f700fdb4d71885a1b17f59 (diff)
downloadrails-78788ad72390806803adf38d8847fd0c858154f6.tar.gz
rails-78788ad72390806803adf38d8847fd0c858154f6.tar.bz2
rails-78788ad72390806803adf38d8847fd0c858154f6.zip
Performed Returns true if redirect/render has happened
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/metal.rb5
1 files changed, 4 insertions, 1 deletions
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 <tt>return</tt> early out a controller action to avoid <tt>AbstractController::DoubleRenderError</tt>
+ # example in case of multiple render/redirects in single controller action
def performed?
response_body || (response && response.committed?)
end