Forum: Ruby on Rails Difference between "require VS include"

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.
266f1a5c2a6e62a549bc2ae99ca4b1c2?d=identicon&s=25 Palani Kumar (palani)
on 2008-09-15 15:58
Hi,
   Can any one please tell me the difference between require statement
and include statement in Rails application...please
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-09-15 16:15
(Received via mailing list)
On 15 Sep 2008, at 14:58, Palani Kumar wrote:

>
> Hi,
>   Can any one please tell me the difference between require statement
> and include statement in Rails application...please

They're basically completely different. require means 'go and load
this file'. include means 'include this module in the current module/
class/whatever'. For example in the context of a class this will add
the constants and methods from the module to the class in question.

Fred
266f1a5c2a6e62a549bc2ae99ca4b1c2?d=identicon&s=25 Palani Kumar (palani)
on 2008-09-15 16:17
Frederick Cheung wrote:
> On 15 Sep 2008, at 14:58, Palani Kumar wrote:
>
>>
>> Hi,
>>   Can any one please tell me the difference between require statement
>> and include statement in Rails application...please
>
> They're basically completely different. require means 'go and load
> this file'. include means 'include this module in the current module/
> class/whatever'. For example in the context of a class this will add
> the constants and methods from the module to the class in question.
>
> Fred




           Thank you so much Fred Thanks
This topic is locked and can not be replied to.