Don't do remove_possible_method when delegate is used. Two reasons: 1) warnings should be shown, and fixed at the source and 2) the code is slow. Fixes #1937.

This commit is contained in:
Jon Leighton
2011-07-18 00:22:12 +01:00
parent e9bd83402e
commit fcbde454f6
2 changed files with 2 additions and 5 deletions

View File

@@ -167,6 +167,7 @@ module AbstractController
included do included do
class_attribute :_layout_conditions class_attribute :_layout_conditions
remove_possible_method :_layout_conditions
delegate :_layout_conditions, :to => :'self.class' delegate :_layout_conditions, :to => :'self.class'
self._layout_conditions = {} self._layout_conditions = {}
_write_layout_method _write_layout_method

View File

@@ -127,10 +127,6 @@ class Module
end end
module_eval(<<-EOS, file, line - 5) module_eval(<<-EOS, file, line - 5)
if instance_methods(false).map(&:to_s).include?("#{prefix}#{method}")
remove_possible_method("#{prefix}#{method}")
end
def #{prefix}#{method}(*args, &block) # def customer_name(*args, &block) def #{prefix}#{method}(*args, &block) # def customer_name(*args, &block)
#{to}.__send__(#{method.inspect}, *args, &block) # client.__send__(:name, *args, &block) #{to}.__send__(#{method.inspect}, *args, &block) # client.__send__(:name, *args, &block)
rescue NoMethodError # rescue NoMethodError rescue NoMethodError # rescue NoMethodError