uninitialized constant CarrierWave

carrierwave, passenger, ruby-on-rails

Solution

You need to add carrierwave to your application.rb file like this:

require File.expand_path('../boot', __FILE__)

require 'rails/all'

require 'carrierwave'

if defined?(Bundler)
  # Bundler stuff
end

# Rest of file ommited.

This worked for me in production using nginx/unicorn. Don't forget to restart your unicorn server.

Problem

I am deploying my first rails app using passenger and capistrano. every thing is fine until i faced this error when I tried to launch the app in the browser. ``` Error message: uninitialized constant CarrierWave Exception class: NameError ``` you can see the message in details at http://test.ajhezaty.com/ the site works perfectly locally and CarrierWave uploading the image correctly. I tried to restart the VPS server by running ``` sudo /etc/init.d/httpd2 restart ``` but it didnt fix the issue. for your information the gem installed on the server ``` $ gem list | grep carrierwave carrierwave (0.6.1) ```

Original source