require with include?

X

Xeno Campanoli

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

Yossef Mendelssohn

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,172
Messages
2,570,933
Members
47,472
Latest member
blackwatermelon

Latest Threads

Top