2012-03-28 55 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

相关问题