纸夹异常:Paperclip :: AdapterRegistry :: NoHandlerError

44

我在Rails 3.2.2中使用Paperclip 3.0.1时遇到了这个错误:

**Paperclip::AdapterRegistry::NoHandlerError** 
(No handler found for "2009-11-29-133527.jpg"):

我的模型中有:

class Product < ActiveRecord::Base
    ...
    has_many :assets 
    accepts_nested_attributes_for :assets
 end

 class Asset < ActiveRecord::Base
     belongs_to :product
     has_attached_file :image,
               :path => ":rails_root/public/system/:attachment/:id/:style/:filename",
               :url => "/system/:attachment/:id/:style/:filename", 
               :styles => { :medium => "300x300>", :thumb => "100x100>" }
  end

异常发生在:

def create
     **@product = Product.new params[:product]**
     ...
end

带有参数:

{...,
 "product"=>{"title"=>"wibble1", 
             **"assets_attributes"=>{"0"=>{"image"=>"2009-11-29-133527.jpg"}
                                  },** 
             "description"=>"Who is wibble...", 
             "price"=>"23.45"
            }, 
             "commit"=>"Create Product", 
             ...}

有人知道发生了什么吗?

11个回答

0

当我们从4.2.x升级到4.3.x时,我们不得不将主要的paperclip字段属性(pictureimage等)从相对URL更改为完整URL以消除此错误。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接