# The problem about Module's extend method

**URL:** <https://www.ruby-forum.com/t/the-problem-about-modules-extend-method/113248>\
**Category:** Rails\
**Created:** [August 29, 2007, 8:26am UTC](https://www.ruby-forum.com/t/the-problem-about-modules-extend-method/113248 "2007-08-29T08:26:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gaoxt1983](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b4bc9f/32.png) [@gaoxt1983](https://www.ruby-forum.com/u/gaoxt1983)\
**Post date:** [August 29, 2007, 8:26am UTC](https://www.ruby-forum.com/t/the-problem-about-modules-extend-method/113248/1 "2007-08-29T08:26:33Z")

</div>

Now I try to overwrite a class’s private class  
method(ActiveRecord::Base)ï¼Œbut it seems doesn’t workï¼Œlook this  
scenarioï¼š

1. module Dummy

2. private

3. 

```
def method_has

```

4. 

```
  puts "new methods has"

```

5. 

```
end

```

6. 
7. 

```
def method_not_has

```

8. 

```
  puts "method not has"

```

9. 

```
end

```

10. end

11. class Sample

12. class\<\<self

13. 

```
private

```

14. 

```
  def method_has

```

15. 

```
    puts "method has"

```

16. 

```
  end

```

17. end

18. end

19. 
20. Sample.extend Dummy

21. 
22. Sample.send(:method\_not\_has)=\>“method not has”

23. 
24. Sample.send(:method\_has)=\>“method has”

but what I want is method\_has return the string "new method has"ï¼ŒHow?  
Why?
