aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-04-21 10:58:20 -0300
committerRafael França <rafaelmfranca@gmail.com>2016-04-21 10:58:20 -0300
commit81f4a7dce42e4a81f02c4b2d060d92b718b03d5a (patch)
tree015913ae72dd480d4641a48aafe0f080106d6953
parent875c679a3397a1c41d70b66f5e353926dbd652a5 (diff)
parent7bd2f9177342c57a81880425ab134945aea6fbd9 (diff)
downloadrails-81f4a7dce42e4a81f02c4b2d060d92b718b03d5a.tar.gz
rails-81f4a7dce42e4a81f02c4b2d060d92b718b03d5a.tar.bz2
rails-81f4a7dce42e4a81f02c4b2d060d92b718b03d5a.zip
Merge pull request #24661 from maclover7/fix-22975
Fix ApplicationController.renderer.defaults.merge!
-rw-r--r--actionpack/lib/action_controller/renderer.rb2
-rw-r--r--actionpack/test/controller/renderer_test.rb8
2 files changed, 9 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/renderer.rb b/actionpack/lib/action_controller/renderer.rb
index e4d19e9dba..2775a24e56 100644
--- a/actionpack/lib/action_controller/renderer.rb
+++ b/actionpack/lib/action_controller/renderer.rb
@@ -45,7 +45,7 @@ module ActionController
}.freeze
# Create a new renderer instance for a specific controller class.
- def self.for(controller, env = {}, defaults = DEFAULTS)
+ def self.for(controller, env = {}, defaults = DEFAULTS.dup)
new(controller, env, defaults)
end
diff --git a/actionpack/test/controller/renderer_test.rb b/actionpack/test/controller/renderer_test.rb
index 16d24fa82a..372c09bc23 100644
--- a/actionpack/test/controller/renderer_test.rb
+++ b/actionpack/test/controller/renderer_test.rb
@@ -87,6 +87,14 @@ class RendererTest < ActiveSupport::TestCase
assert_equal "<p>1\n<br />2</p>", render[inline: '<%= simple_format "1\n2" %>']
end
+ test 'rendering with user specified defaults' do
+ ApplicationController.renderer.defaults.merge!({ hello: 'hello', https: true })
+ renderer = ApplicationController.renderer.new
+ content = renderer.render inline: '<%= request.ssl? %>'
+
+ assert_equal 'true', content
+ end
+
private
def render
@render ||= ApplicationController.renderer.method(:render)