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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
danfrost wrote:> Could anyone tell me why you use .send when callling "include" in > rails plugins?? > > E.g. > ActiveRecord::Base.send :include, SomeClass::ClassMethodsTake 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks - nice answer. So, ".send" by-passes all private / protected restrictions? On Apr 19, 9:28 pm, Phlip <phlip2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. -- Posted via http://www.ruby-forum.com/.
On Apr 22, 9:33 am, Shaun Keller <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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> -- > Posted viahttp://www.ruby-forum.com/.