How to require a regular module into my controller?


#1

I created a modules directory under my app. root (RAILS_ROOT/app)

I’m trying to “require in” a module in that directory into my
controller.

I tried require ‘modules/module.rb’
I tried require “#{RAILS_ROOT}/app/modules/ESimplyUtil”

The module file is in modules/ESimplyUtil.rb. Is that the right name?

Neither of these works.

How can I successfully require in my module?

Thanks,
Wes


#2

Rails loads everything in {$RAILS_ROOT}/lib automatically(then you
dont’ have to explicitly require it). That’s where I have my app wide
library code. If you want to require a gem or ruby library you can do
it in app/controllers/application.rb which then will be available
application wide. Atleast this has worked for me.

-bakki