diff --git a/lib/draper/helper_proxy.rb b/lib/draper/helper_proxy.rb index 6b50f4a..5814814 100644 --- a/lib/draper/helper_proxy.rb +++ b/lib/draper/helper_proxy.rb @@ -12,7 +12,7 @@ module Draper # Sends helper methods to the view context. def method_missing(method, *args, &block) - self.class.delegate method, to: :view_context + self.class.define_proxy method send(method, *args, &block) end @@ -22,6 +22,12 @@ module Draper private + def self.define_proxy(name) + define_method name do |*args, &block| + view_context.send(name, *args, &block) + end + end + def current_view_context ActiveSupport::Deprecation.warn("wrong number of arguments (0 for 1) passed to Draper::HelperProxy.new", caller[1..-1]) Draper::ViewContext.current.view_context