所以这是我关于StackOverflow的第一个问题。
我正在尝试在Rails 3.2.3上实现Paperclip,在点击"提交"创建一个带有上传图像的配置文件后,我得到:
Paperclip::AdapterRegistry::NoHandlerUsersController中的错误#更新
未找到"Screen Shot 2012-09-01 at 11.03.43 AM.png"的处理程序
我的服务器日志读取,
回形针::AdapterRegistry::NoHandlerError(找不到"Screen Shot 2012-09-01 at 11.03.43 AM.png"的处理程序):app/controllers/users_controller.rb:65:在
block in update' app/controllers/users_controller.rb:64:in
更新中
在我的用户模型中,我有
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中,我有一个宝石"回形针","~>3.1.4"(更新:从那以后,我直接从思想机器人中取出了回形针,问题仍然存在)。我已经运行了捆绑安装。我已经运行了db:migrate。我已经阅读了这个StackOverflow条目,但无论是否包含"multipart=>true",错误都会持续存在。当我尝试Emerson Lackey教程时,它一直工作到他试图显示"5.次…"命令的输出。
我感兴趣的是让Paperclip发挥作用,了解什么是"NoHandlerError"以及如何在未来避免它。
你试过railscasts第134集吗?
http://railscasts.com/episodes/134-paperclip?view=asciicast