fixing activerecord tests [#4205 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
This commit is contained in:
parent
7a83abe52f
commit
843255a763
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user