Why .send?

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

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

Thanks - nice answer.

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

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.

On Apr 22, 9:33 am, Shaun K. [email protected]
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