我試圖用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