未初始化的常量CarrierWave [英] uninitialized constant CarrierWave
问题描述
我正在使用乘客和capistrano部署我的第一个Rails应用程序。
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
您可以在 http://test.ajhezaty.com/
该站点在本地运行良好,并且CarrierWave可以正确上传图像。
the site works perfectly locally and CarrierWave uploading the image correctly.
我尝试通过运行
sudo /etc/init.d/httpd2 restart
但它没有解决问题。
供您参考,服务器上安装的gem
for your information the gem installed on the server
$ gem list | grep carrierwave
carrierwave (0.6.1)
推荐答案
您需要像这样向您的 application.rb 文件中添加载波:
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.
这对我使用nginx / unicorn进行生产很有用。不要忘记重启独角兽服务器。
This worked for me in production using nginx/unicorn. Don't forget to restart your unicorn server.
这篇关于未初始化的常量CarrierWave的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!