我试图用Paperclip与我的Rails应用程序到化身添加到用户,但在创建用户时,它也救不了我的图片或更新的数据库列。回形针将不保存图像中的Rails应用程序
这是什么型号的样子:
class User < ActiveRecord::Base
has_attached_file :avatar
而且在HAML的registerform:
- form_for :user, @user, :url => { :action => "signup" }, :html => { :multipart => true } do |f|
...
...
%li
%div{:class => "header"} Profilepicture
%div{:class => "input"}
= f.file_field :avatar
当我看日志,这是被传递什么样的“注册”,在动作:
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"=>"[email protected]"}}
[paperclip] Saving attachments.
回形针说,这是保存模板,但是当我看在public
文件夹在我的应用程序中创建了一个system
,但system
文件夹为空。
所以看起来它是不是保存图片的文件夹。
它得到通过的形式处理,并保存在我的/tmp
文件夹中。
也许你们有任何提示或知道这个问题可能是什么?
我有同样的问题,我试图添加attr_accessible,但它仍然dosent保存正确,并显示一条丢失的消息,当我尝试加载图片。这是非常令人沮丧的 – 2010-08-02 21:27:57
尝试设置:路径选项。它可能有帮助 – Lisinge 2010-08-04 05:57:24