aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/base.rb8
-rw-r--r--actionpack/lib/action_view/helpers/prototype_helper.rb4
-rw-r--r--actionpack/test/template/javascript_helper_test.rb5
-rw-r--r--actionpack/test/template/prototype_helper_test.rb4
4 files changed, 16 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index cc89c66a39..e1f35b8105 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -158,6 +158,7 @@ module ActionView #:nodoc:
# See the ActionView::Helpers::PrototypeHelper::GeneratorMethods documentation for more details.
class Base
include ERB::Util
+ extend ActiveSupport::Memoizable
attr_accessor :base_path, :assigns, :template_extension
attr_accessor :controller
@@ -324,11 +325,14 @@ module ActionView #:nodoc:
template
end
end
-
- extend ActiveSupport::Memoizable
memoize :pick_template
private
+ def extended_by_without_helpers #:nodoc:
+ extended_by.reject { |mod| mod.name =~ /^ActionView::Helpers/ }
+ end
+ memoize :extended_by_without_helpers
+
# Evaluate the local assigns and pushes them to the view.
def evaluate_assigns
unless @assigns_added
diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb
index 4c3a8311a5..09dbb67c0a 100644
--- a/actionpack/lib/action_view/helpers/prototype_helper.rb
+++ b/actionpack/lib/action_view/helpers/prototype_helper.rb
@@ -588,9 +588,7 @@ module ActionView
private
def include_helpers_from_context
- @context.extended_by.each do |mod|
- extend mod unless mod.name =~ /^ActionView::Helpers/
- end
+ @context.send(:extended_by_without_helpers).each { |mod| extend mod }
extend GeneratorMethods
end
diff --git a/actionpack/test/template/javascript_helper_test.rb b/actionpack/test/template/javascript_helper_test.rb
index d41111127b..2e9cdd3fea 100644
--- a/actionpack/test/template/javascript_helper_test.rb
+++ b/actionpack/test/template/javascript_helper_test.rb
@@ -108,4 +108,9 @@ class JavaScriptHelperTest < ActionView::TestCase
def test_javascript_cdata_section
assert_dom_equal "\n//<![CDATA[\nalert('hello')\n//]]>\n", javascript_cdata_section("alert('hello')")
end
+
+ private
+ def extended_by_without_helpers
+ []
+ end
end
diff --git a/actionpack/test/template/prototype_helper_test.rb b/actionpack/test/template/prototype_helper_test.rb
index abc9f930dd..5397ae3688 100644
--- a/actionpack/test/template/prototype_helper_test.rb
+++ b/actionpack/test/template/prototype_helper_test.rb
@@ -53,6 +53,10 @@ class PrototypeHelperBaseTest < ActionView::TestCase
false
end
+ def extended_by_without_helpers
+ []
+ end
+
def create_generator
block = Proc.new { |*args| yield *args if block_given? }
JavaScriptGenerator.new self, &block