I have modified application.rb to autoload my lib directory:
config.autoload_paths += %W(#{config.root}/lib)
I have defined a module X::Y in the file lib/x/y.rb with a function execute(param).
In a controller (A::B), I call execute in this file by including the file and then calling the function:
require 'x/y'
results = X::Y.execute(param)
This works perfectly for a short while after the application is loaded but quickly I start getting the error:
NameError in A::B#index
uninitialized constant A::B::X
Does anyone know what I might be doing wrong here?
Thanks!
I decided to move these into the model for ease.