问题
I am using MiniMagick gem to crop images and then saving them with mongoid paperclip. Everything seems to be working perfectly in development but in production I am getting the error "ActionView::Template::Error (uninitialized constant Model Name::MiniMagick)". these are the lines giving the error inside the model:
def profile_geometry
img = MiniMagick::Image.open(avatar.path)
@geometry = {:width => img[:width], :height => img[:height] }
end
Any help would be hugely appreciated.
EDIT: Gemfile
gem 'rails', '4.0.0'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jbuilder', '~> 1.2'
gem 'twitter-bootstrap-rails'
gem 'quiet_assets'
group :development do
gem 'awesome_print'
end
group :production do
gem 'unicorn'
end
group :doc do
gem 'sdoc', require: false
end
gem 'mini_magick'
gem 'execjs'
gem 'therubyracer'
gem "mongoid", "~> 4.0.0.beta1"
gem "devise"
gem "mongoid-paperclip", :require => "mongoid_paperclip"
gem "cancan"
gem "simple-rss"
gem 'capistrano'
gem 'rvm-capistrano'
gem 'stripe'
回答1:
Well it was the restart that did it. After restarting nginx and unicorn several times I restarted the rackspace server completely and everything is fine now.
来源:https://stackoverflow.com/questions/23798045/minimagick-not-working-in-production