提交 80e90b0b 编写于 作者: G Guillermo Iguaran

Merge pull request #12622 from timsly/helpers-from-outside

pass app config to controller helper proxy
......@@ -73,7 +73,11 @@ def helper_attr(*attrs)
# Provides a proxy to access helpers methods from outside the view.
def helpers
@helper_proxy ||= ActionView::Base.new.extend(_helpers)
@helper_proxy ||= begin
proxy = ActionView::Base.new
proxy.config = config.inheritable_copy
proxy.extend(_helpers)
end
end
# Overwrite modules_for_helpers to accept :all as argument, which loads
......
......@@ -201,6 +201,12 @@ def test_helper_proxy
# fun/pdf_helper.rb
assert methods.include?(:foobar)
end
def test_helper_proxy_config
AllHelpersController.config.my_var = 'smth'
assert_equal 'smth', AllHelpersController.helpers.config.my_var
end
private
def expected_helper_methods
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册