Rails3和Paperclip出现NoHandlerError错误

4
这是我在StackOverflow上的第一个问题。
我正在尝试在Rails 3.2.3上实现Paperclip。在上传图像创建个人资料后,单击“提交”按钮后,出现以下错误信息:
Paperclip :: AdapterRegistry :: NoHandlerError in UsersController#update 未找到“No handler found for"Screen Shot 2012-09-01 at 11.03.43 AM.png"”的处理程序
我的服务器日志如下:
Paperclip :: AdapterRegistry :: NoHandlerError(未找到“No handler found for"Screen Shot 2012-09-01 at 11.03.43 AM.png"”):   app / controllers / users_controller.rb:65中的块'update'   app / controllers / users_controller.rb:64中的update 在我的User模型中,我有
attr_accessible :avatar

has_attached_file :avatar, 
        :styles => { 
          :large => "500x500>", 
          :medium => "213x213>", # profile image
          :thumb => "50x50>",
          :smaller => "30x30>" }, 
          :processors => [:cropper],
         # tells paperclip how to crop the image  
        :storage => :s3,
        :s3_credentials => "#{Rails.root}/config/s3.yml", # TODO 
        :path => ":attachment/:id/:style/:basename.:extension",
        :bucket => 'eventsbucket'

无论我是否包含S3信息,这个错误仍然存在。在我的迁移中,我有:
class AddAvatarColumnsToUsers < ActiveRecord::Migration
  def self.up
    add_attachment :users, :avatar
  end

  def self.down
    remove_attachment :users, :avatar
  end
end

最后,在我的用户控制器更新操作中,我有:
def update
    respond_to do |format|
      if @user.update_attributes(params[:user])
        sign_in @user
        format.html { redirect_to @user, notice: 'Profile Successfully Updated' }
        format.json { head :no_content }
      else
        format.html { render action: "edit" }
        format.json { render json: @user.errors, status: :unprocessable_entity }
      end
   end
end

在我的Gemfile中,我有gem "paperclip","〜> 3.1.4"(更新:我已经直接从thoughtbot拉出了Paperclip,问题仍然存在)。我运行了bundle install。我运行了db:migrate。我阅读了this StackOverflow entry,但无论是否包括“multipart => true”,错误仍然存在。当我尝试Emerson Lackey Tutorial时,它工作到他尝试显示“5.times ...”命令的输出为止。
我对使Paperclip工作以及理解“NoHandlerError”是什么以及如何在将来避免它都感兴趣。

1
关于 https://dev59.com/q2kw5IYBdhLWcg3wPYIP,有什么想法? - freemanoid
看起来很有前途,等我有时间了解更多,只是出于好奇心。谢谢你提醒我。 - vtacreative
1个回答

0

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