2012-03-28 61 views
1

我正在使用refinerycms 1.0.9,並且想要更改蜻蜓保存文件的默認位置。在上傳文件中更改refinerycms中的本地存儲位置

這是我在配置/初始化dragonfly.rb:

require 'dragonfly' 

app = Dragonfly[:app_name] 
app.datastore = Dragonfly::DataStorage::FileDataStore.new 

app.datastore.configure do |d| 
    d.root_path = '/Projects/images' 
    d.server_root = '/Projects' 
    d.store_meta = false 
end 

當我救我得到以下錯誤文件:

Dragonfly::Shell::CommandFailed (Command failed (identify '/var/folders/5t/mf86p8gx6bz94dzfb88xpvpr0000gn/T/RackMultipart20120328-6943-1vbpa7u') with exit status 127): 

UPDATE

我重新安裝的ImageMagick並擺脫了錯誤,但它仍然將文件保存到/ system/images。我試圖覆蓋煉油廠的圖像模型,並補充說:

image_accessor :image do 
    storage_path{ "/Projects/images/#{rand(100)}" } 
end 

但這也沒有工作。

回答

0

基於this post從作者,它看起來像你想的storage_path選項模型(S)設置:

storage_path{ "some/path/#{first_name}/#{rand(100)}" } # or whatever you want it to be 
+0

我添加了下面到我的幻燈片模式 'image_accessor:照片do' 'storage_path { 「幻燈片/#{蘭特(100)}」'' end' 現在我得到這個錯誤 未定義的方法'photo_uid」爲#<幻燈片:0x007f8f54e16708> – Scott 2012-03-28 15:23:25

+0

增加了photo_uid列到我的模型和現在我回到了原來的錯誤。 – Scott 2012-03-28 15:42:49

+0

你的目標文件夾是否存在?我有一個模糊的回憶,它需要在蜻蜓可以使用它之前存在(具有適當的權限)。 – 2012-03-30 14:11:18

相關問題