提交 843255a7 编写于 作者: A Aaron Patterson 提交者: Jeremy Kemper

fixing activerecord tests [#4205 state:resolved]

Signed-off-by: NJeremy Kemper <jeremy@bitsweat.net>
上级 7a83abe5
......@@ -13,6 +13,7 @@
require 'active_support/core_ext/string/behavior'
require 'active_support/core_ext/object/singleton_class'
require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/module/remove_method'
require 'arel'
require 'active_record/errors'
......
......@@ -27,7 +27,7 @@ def superclass_delegating_accessor(name, options = {})
# inheritance behavior, without having to store the object in an instance
# variable and look up the superclass chain manually.
def _stash_object_in_method(object, method, instance_reader = true)
singleton_class.send(:remove_possible_method, method)
singleton_class.remove_possible_method(method)
singleton_class.send(:define_method, method) { object }
remove_possible_method(method)
define_method(method) { object } if instance_reader
......@@ -37,7 +37,7 @@ def _superclass_delegating_accessor(name, options = {})
singleton_class.send(:define_method, "#{name}=") do |value|
_stash_object_in_method(value, name, options[:instance_reader] != false)
end
self.send("#{name}=", nil)
send("#{name}=", nil)
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册