Now I try to overwrite a class’s private class
method(ActiveRecord::Base),but it seems doesn’t work,look this
scenario:
-
module Dummy
-
private
-
def method_has
-
puts "new methods has"
-
end
-
def method_not_has
-
puts "method not has"
-
end
-
end
-
class Sample
-
class<<self
-
private
-
def method_has
-
puts "method has"
-
end
-
end
-
end
-
Sample.extend Dummy
-
Sample.send(:method_not_has)=>“method not has”
-
Sample.send(:method_has)=>“method has”
but what I want is method_has return the string "new method has",How?
Why?