Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uninitialized constant CarrierWave

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)
like image 676
Abdulaziz Alsubaie Avatar asked Dec 03 '22 04:12

Abdulaziz Alsubaie


1 Answers

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.

like image 152
Stephan1990 Avatar answered Dec 29 '22 16:12

Stephan1990