ruby - Carrierwave - Error when processing images -


the problem following error thrown on mongoids save! action.

mongoid::errors::validations: validation failed - img failed processed. ~/.rvm/gems/ruby-1.8.7-p249/gems/mongoid-2.0.0.rc.7/lib/mongoid/persistence.rb:234:in `fail_validate!' ~/.rvm/gems/ruby-1.8.7-p249/gems/mongoid-2.0.0.rc.7/lib/mongoid/persistence.rb:75:in `save!' ./app.rb:29:in `post /upload' 

the setup following:

require "sinatra"     # 1.1.2 require "mongoid"     # 2.0.0.beta.19 require "rmagick"     # 2.12.2 require "carrierwave" # 0.5.1 require "carrierwave/orm/mongoid" require 'carrierwave/processing/rmagick' ....   mongoid.database = mongo::connection.new('somehost', 1234).db('test')  class uploader < carrierwave::uploader::base   include carrierwave::rmagick   storage :file    def store_dir     "uploads"   end   process :resize_to_fit => [80, 80] end   class image   include mongoid::document    mount_uploader :img, uploader end   ....  post '/upload'   @img = image.new   @img.img = params[:file]   @img.save!   redirect '/' end 

the glitch somewhere in processing:

process :resize_to_fit => [80, 80] 

if remove line. works expected.

ok. didn't follow traces deep enough: problem missing jpeg-delegate in imagemagick. naturally processing of jpeg-files failed.

the solution reinstall imagemagick source.

still it's quite opaque when mongoid throws error called carrierwave because gets error rmagick triggered imagemagick.

still. in retrospective it's quite obvious :-)


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -