Skip to content

Instantly share code, notes, and snippets.

@btakita
Created March 5, 2009 18:35
Show Gist options
  • Save btakita/74480 to your computer and use it in GitHub Desktop.
Save btakita/74480 to your computer and use it in GitHub Desktop.
# TODO: BT - Remove this when this is integrated into RR.
#Adding this monkey patch to get around issue with Double R and named scopes
RR::DoubleInjection.class_eval do
def initialize(subject, method_name)
@subject = subject
@method_name = method_name.to_sym
if object_has_method?(method_name)
begin
meta.__send__(:alias_method, original_method_name, method_name)
rescue NameError => e
begin
subject.send(method_name)
meta.__send__(:alias_method, original_method_name, method_name)
rescue NameError => e
end
end
end
@doubles = []
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment