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.
Sijo k. (Guest)
on 2009-01-19 11: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
Roscus F. (Guest)
on 2009-01-21 08: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
Roscus F. (Guest)
on 2009-01-21 08: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
Sijo k. (Guest)
on 2009-01-21 08:42
Hi
    Thanks for the reply
Sijo
This topic is locked and can not be replied to.