0

I have a module in my Rails app Constants, which has a few constants defined within itself. I recently included the mongo gem in my rails app and now all references to those constants throws an error.

uninitialized constant Mongo::Constants::MY_FAVORITE_CONSTANT

The code is roughly as follows:

class Hello
  def self.world
    Constants::MY_FAVORITE_CONSTANT
  end
end

Now I tried changing the line in the above code to ::Constants::MY_FAVORITE_CONSTANT but that results in the same error.

The module Constants resides in app/models/constants.rb.

Any help here would really be useful. Thanks.

Gaurav Agarwal
  • 14,664
  • 4
  • 29
  • 41

0 Answers0