# Include vs extend

**URL:** <https://www.ruby-forum.com/t/include-vs-extend/123496>\
**Category:** Rails\
**Created:** [December 18, 2007, 7:40am UTC](https://www.ruby-forum.com/t/include-vs-extend/123496 "2007-12-18T07:40:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ayyanar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@ayyanar](https://www.ruby-forum.com/u/ayyanar)\
**Post date:** [December 18, 2007, 7:40am UTC](https://www.ruby-forum.com/t/include-vs-extend/123496/1 "2007-12-18T07:40:42Z")

</div>

Can any one give simple definition for include and extend since iam  
stumbled over the examples in the net

---

<div class="post-metadata">

**Author:** ![ayyanar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@ayyanar](https://www.ruby-forum.com/u/ayyanar)\
**Post date:** [December 18, 2007, 7:57am UTC](https://www.ruby-forum.com/t/include-vs-extend/123496/2 "2007-12-18T07:57:47Z")

</div>

Aren’t they the same thing?

On Dec 18, 2007 5:10 PM, Ayyanar from Aspire Systems \<  
removed\_email\_address@domain.invalid\> wrote:

> ## Can any one give simple definition for include and extend since iam stumbled over the examples in the net
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Ryan B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!

---

<div class="post-metadata">

**Author:** ![ayyanar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@ayyanar](https://www.ruby-forum.com/u/ayyanar)\
**Post date:** [December 18, 2007, 8:05am UTC](https://www.ruby-forum.com/t/include-vs-extend/123496/3 "2007-12-18T08:05:27Z")

</div>

No Ryan, it is not same. I think extend will allow the access to the  
class methods of the extended module

---

<div class="post-metadata">

**Author:** ![ayyanar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@ayyanar](https://www.ruby-forum.com/u/ayyanar)\
**Post date:** [December 18, 2007, 9:58am UTC](https://www.ruby-forum.com/t/include-vs-extend/123496/4 "2007-12-18T09:58:26Z")

</div>

On 18 Dec 2007, at 07:05, Ayyanar from Aspire Systems wrote:

> No Ryan, it is not same. I think extend will allow the access to the  
> class methods of the extended module

Have a look at

> **[Extending your include knowledge of Ruby](https://macournoyer.wordpress.com/2007/07/06/extending-your-include-knowledge-of-ruby/)**
>
> extend and include are two confusing methods, but they go hand in hand like Lychee and Vodka (humm…). Hopefully I’ll try to clarify this as short as possible. include(a\_module) is calle…

(this is a ruby rather than a rails question, so consider posting this  
sort of thing to the ruby-talk mailing list)

Fred

---

<div class="post-metadata">

**Author:** ![ayyanar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@ayyanar](https://www.ruby-forum.com/u/ayyanar)\
**Post date:** [December 18, 2007, 10:04am UTC](https://www.ruby-forum.com/t/include-vs-extend/123496/5 "2007-12-18T10:04:59Z")

</div>

I have created a screencast for this :  
[http://www.zepho.com/download/IncludeExtend.mov.zip](http://www.zepho.com/download/IncludeExtend.mov.zip)  
Enjoy!

On Dec 17, 2007 10:40 PM, Ayyanar from Aspire Systems \<

---

<div class="post-metadata">

**Author:** ![ayyanar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@ayyanar](https://www.ruby-forum.com/u/ayyanar)\
**Post date:** [December 18, 2007, 8:06pm UTC](https://www.ruby-forum.com/t/include-vs-extend/123496/6 "2007-12-18T20:06:17Z")

</div>

I have put in different cases together.

[http://www.neeraj.name/503/include-extend-module\_eval-class\_eval](http://www.neeraj.name/503/include-extend-module_eval-class_eval)
