Thursday, June 26, 2014

Ruby on Rails gem: Uninitialized Constant (class name)

I was working on a Ruby on Rails project earlier, and ran into a really frustrating issue regarding gems.

I added the influxdb gem to my Gemfile, did a bundle install, saw it installed successfully, then tried to use it in an ApplicationController.  No luck!  Over and over it was acting like the gem wasn't installed (Uninitialized Constant error ApplicationController::InfluxDB when trying to reference the class defined in the gem).

When I ran the same code using the rails console, it worked fine, which lead me to believe it was some problem with bundler or the environments.

It turns out the solution was simply to restart the apache/ngnix/whatever server! "service apache2 restart" in my case. Whew!


  1. Great to read about the question I really want to be discussed. i would follow your site.

  2. If this really was a problem with the supplier, it's worth discussing all these problems and if it does not eliminate them then break the contract.

  3. Sometimes one person confronting a similar problem does nothing and gives up his job while the other, spending a lot of time and effort, still finds the solution that suits everyone.

  4. CNC machining revolutionized the trade in the Nineteen Sixties and is the dominant method of machining at present. It is important to understand the varied benefits and downsides of using this technology in your manufacturing operations. Safety is one other main reason why CNC machining is regularly used. There are sharp instruments, heavy objects, high velocities, and enormous amounts of high voltage electricity being used. When a human may be taken out of that setting, it could possibly} tremendously cut back the danger of injury to personnel. If certainly one of your instruments best electric pencil sharpener itself is burned, you’ll want to adjust the settings as wanted for that exact device so it isn’t scarring the material.