# Why .send?

**URL:** <https://www.ruby-forum.com/t/why-send/165919>\
**Category:** Rails\
**Created:** [April 19, 2009, 10:27pm UTC](https://www.ruby-forum.com/t/why-send/165919 "2009-04-19T22:27:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![danfrost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eada6e/32.png) [@danfrost](https://www.ruby-forum.com/u/danfrost)\
**Post date:** [April 19, 2009, 10:27pm UTC](https://www.ruby-forum.com/t/why-send/165919/1 "2009-04-19T22:27:09Z")

</div>

Hi all,

Could anyone tell me why you use .send when callling “include” in  
rails plugins??

E.g.  
ActiveRecord::Base.send :include, SomeClass::ClassMethods

Cheers,  
Dan

---

<div class="post-metadata">

**Author:** ![danfrost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eada6e/32.png) [@danfrost](https://www.ruby-forum.com/u/danfrost)\
**Post date:** [April 19, 2009, 10:30pm UTC](https://www.ruby-forum.com/t/why-send/165919/2 "2009-04-19T22:30:06Z")

</div>

danfrost wrote:

> Could anyone tell me why you use .send when callling “include” in  
> rails plugins??
> 
> E.g.  
> ActiveRecord::Base.send :include, SomeClass::ClassMethods

Take it out and see.

.include is protected or private or something. send() just says “shut up  
and do  
exactly what I say, b----!”

–  
Phlip  
[http://flea.sourceforge.net/resume.html](http://flea.sourceforge.net/resume.html)

---

<div class="post-metadata">

**Author:** ![danfrost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eada6e/32.png) [@danfrost](https://www.ruby-forum.com/u/danfrost)\
**Post date:** [April 20, 2009, 12:32am UTC](https://www.ruby-forum.com/t/why-send/165919/3 "2009-04-20T00:32:27Z")

</div>

Thanks - nice answer.

So, “.send” by-passes all private / protected restrictions?

---

<div class="post-metadata">

**Author:** ![danfrost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eada6e/32.png) [@danfrost](https://www.ruby-forum.com/u/danfrost)\
**Post date:** [April 22, 2009, 10:33am UTC](https://www.ruby-forum.com/t/why-send/165919/4 "2009-04-22T10:33:24Z")

</div>

danfrost wrote:

> Thanks - nice answer.
> 
> So, “.send” by-passes all private / protected restrictions?

In 1.8, definitely. In 1.9…I think I read somewhere that it didn’t any  
more. Don’t quote me on that, though. If it’s used in the rails plugins,  
that wouldn’t really make sense.

---

<div class="post-metadata">

**Author:** ![danfrost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eada6e/32.png) [@danfrost](https://www.ruby-forum.com/u/danfrost)\
**Post date:** [April 22, 2009, 12:40pm UTC](https://www.ruby-forum.com/t/why-send/165919/5 "2009-04-22T12:40:18Z")

</div>

On Apr 22, 9:33 am, Shaun K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> danfrost wrote:
> 
> > Thanks - nice answer.
> 
> > So, “.send” by-passes all private / protected restrictions?
> 
> In 1.8, definitely. In 1.9…I think I read somewhere that it didn’t any  
> more. Don’t quote me on that, though. If it’s used in the rails plugins,  
> that wouldn’t really make sense.

1.9 was like that for a while (with a separate send! that still  
ignored whether a method was private/protected) but that was  
eventually removed.

Fred
