2010-10-04 77 views

回答

0

您需要創建一個新模塊(在插件中稱爲「後端」),Technoweenie::AttachmentFu::Backends.const_get('YourChosenBackend')

這個後端的合同恐怕是在其他後端模塊中隱式定義的。您可以參考s3,file_systemdb。通過合同,我的意思是有一些方法需要重寫/定義。幾個例子(我把他們從file_sysyem_backend.rb

full_filename(thumbnail = nil)                                   
base_path                                        
attachment_path_id                                      
partitioned_path(*args)                                     
public_filename(thumbnail = nil)                                  
filename=(value)                                      
create_temp_file                                      
destroy_file                                       
rename_file                                        
save_to_storage                                       
current_data 

一旦你定義了你的後端,然後你可以通過選擇:storage => :your_chosenhas_attachment