Forum: Ruby on Rails ActionController::Base.send :include, etc

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
661ae6e97d0e16c2af2aaf7d197e8387?d=identicon&s=25 Sijo k g (sijo)
on 2009-01-19 10:19
Hi
    In one of the method say
require_helpers

i have the code
helper_constant = SomeHelper
ActionController::Base.send :include, helper_constant
ActionView::Base.send :include, helper_constant
ActionView::Helpers::FormBuilder.send :include, helper_constant

     And I did not understand what actually the above does?

Sijo
7598be6292051dd256ec01bef4dba2a2?d=identicon&s=25 Roscus Farmer (roscus)
on 2009-01-21 07:00
i think this topic will help you.
http://www.rubycentral.com/pickaxe/tut_modules.html
Section : Mixins




Sijo Kg wrote:
> Hi
>     In one of the method say
> require_helpers
>
> i have the code
> helper_constant = SomeHelper
> ActionController::Base.send :include, helper_constant
> ActionView::Base.send :include, helper_constant
> ActionView::Helpers::FormBuilder.send :include, helper_constant
>
>      And I did not understand what actually the above does?
>
> Sijo
7598be6292051dd256ec01bef4dba2a2?d=identicon&s=25 Roscus Farmer (roscus)
on 2009-01-21 07:17
and see following codes:

module MyTools
  def run(*args)
    puts "let #{args.join(' ')} run"
  end
end

class TryTools
  #include MyTools
  def initialize()
    self.class.send :include,MyTools
  end
end

c=TryTools.new
c.run("me")



Roscus Farmer wrote:
> i think this topic will help you.
> http://www.rubycentral.com/pickaxe/tut_modules.html
> Section : Mixins
>
>
>
>
> Sijo Kg wrote:
>> Hi
>>     In one of the method say
>> require_helpers
>>
>> i have the code
>> helper_constant = SomeHelper
>> ActionController::Base.send :include, helper_constant
>> ActionView::Base.send :include, helper_constant
>> ActionView::Helpers::FormBuilder.send :include, helper_constant
>>
>>      And I did not understand what actually the above does?
>>
>> Sijo
661ae6e97d0e16c2af2aaf7d197e8387?d=identicon&s=25 Sijo k g (sijo)
on 2009-01-21 07:42
Hi
    Thanks for the reply
Sijo
This topic is locked and can not be replied to.