aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/metal/rendering.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/rendering.rb b/actionpack/lib/action_controller/metal/rendering.rb
index 4214399b6f..d054450853 100644
--- a/actionpack/lib/action_controller/metal/rendering.rb
+++ b/actionpack/lib/action_controller/metal/rendering.rb
@@ -11,10 +11,14 @@ module ActionController
# Documentation at ActionController::Renderer#render
delegate :render, to: :renderer
+ RENDERER_LOCK = Mutex.new
+
# Returns a renderer class (inherited from ActionController::Renderer)
# for the controller.
def renderer
- @renderer ||= Renderer.for(self)
+ @renderer || RENDERER_LOCK.synchronize do
+ @renderer ||= Renderer.for(self)
+ end
end
end