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

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
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.