Is there a way to do the include of a module with the require?
Sorry if this is obvious.
On Jun 16, 8:28 pm, Xeno C. [email protected] 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.