# Require with include?

**URL:** <https://www.ruby-forum.com/t/require-with-include/170399>\
**Category:** Ruby\
**Created:** [June 17, 2009, 3:30am UTC](https://www.ruby-forum.com/t/require-with-include/170399 "2009-06-17T03:30:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [June 17, 2009, 3:30am UTC](https://www.ruby-forum.com/t/require-with-include/170399/1 "2009-06-17T03:30:38Z")

</div>

Is there a way to do the include of a module with the require?  
Sorry if this is obvious.

---

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [June 17, 2009, 5:55am UTC](https://www.ruby-forum.com/t/require-with-include/170399/2 "2009-06-17T05:55:40Z")

</div>

On Jun 16, 8:28 pm, Xeno C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is there a way to do the include of a module with the require?  
> Sorry if this is obvious.

The short answer is yes. Including a module is code like any other  
code, and requiring a file runs the code in it. The longer answer  
depends on information like what module you’re trying to include into  
what else, and how you’re going to get that information (especially  
the “what else” part).

To see this in action, note that many Rails plugins work by creating  
modules and then, in the plugin’s init.rb, including the module into  
ActiveRecord::Base.
