我将使用Paperclip来为我的Rails应用程序添加用户头像,但在创建用户时它无法保存我的图像或更新数据库列。
Paperclip说它正在保存模板,但是当我查看应用程序中的
以下是模型的样子:
class User < ActiveRecord::Base
has_attached_file :avatar
以下是Haml中的注册表单:
- form_for :user, @user, :url => { :action => "signup" }, :html => { :multipart => true } do |f|
...
...
%li
%div{:class => "header"} Profilepicture
%div{:class => "input"}
= f.file_field :avatar
当我查看日志时,这就是传递给“signup”操作的内容:
Parameters: {"commit"=>"Save", "action"=>"signup", "controller"=>"user/register", "user"=>{"name"=>"Micke Lisinge", "birthmonth"=>"07", "password_confirmation"=>"[FILTERED]", "nickname"=>"lisinge", "avatar"=>#<File:/tmp/RackMultipart20100426-3076-1x04oxy-0>, "gen"=>"m", "birthday"=>"23", "password"=>"[FILTERED]", "birthyear"=>"1992", "email"=>"lisinge@gmail.coma"}}
[paperclip] Saving attachments.
Paperclip说它正在保存模板,但是当我查看应用程序中的
public
文件夹时,它创建了一个system
文件夹,但是system
文件夹为空。
所以看起来它没有将图片保存到文件夹中。
它由表单处理并保存在我的/tmp
文件夹中。
也许您们有什么提示或知道这个问题是什么?