Take the 2-minute tour ×

I have modified application.rb to autoload my lib directory:


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?


share|improve this question
What are the actual names of X and Y, and the actual path name corresponding to x/y.rb ? –  Kelvin Sep 28 '12 at 20:13
add comment

1 Answer

up vote 0 down vote accepted

I decided to move these into the model for ease.

share|improve this answer
add comment

Your Answer


