Ruby on rails 带ActiveResource的CarrierWave-自定义存储引擎
我需要帮助了解如何让CarrierWave使用ActiveResource对象。我正在一个项目上工作,该项目目前在标准ActiveRecord对象上使用CarrierWave,它工作得非常好。但是,我们正在向远程文件系统迁移,因此我需要CarrierWave来处理ActiveResource对象 我知道CarrierWave允许您编写自己的存储引擎,而不是使用fog、file或mongo grid_fs,但我不知道这个过程的流程是什么 以下是我的努力情况: ReportDocument类Ruby on rails 带ActiveResource的CarrierWave-自定义存储引擎,ruby-on-rails,mongoid,carrierwave,activeresource,Ruby On Rails,Mongoid,Carrierwave,Activeresource,我需要帮助了解如何让CarrierWave使用ActiveResource对象。我正在一个项目上工作,该项目目前在标准ActiveRecord对象上使用CarrierWave,它工作得非常好。但是,我们正在向远程文件系统迁移,因此我需要CarrierWave来处理ActiveResource对象 我知道CarrierWave允许您编写自己的存储引擎,而不是使用fog、file或mongo grid_fs,但我不知道这个过程的流程是什么 以下是我的努力情况: ReportDocument类 cla
class ReportDocument
mount_uploader :merchant_geoip_image, ImageUploader
end
CarrierWave上传器
class ImageUploader < CarrierWave::Uploader::Base
storage MyCustomStorageEngine
end
我的问题是我不能让CarrierWave打电话给我的定制商店代码>和检索保存ReportDocument
对象时的code>方法。Mongoid ORM将其存储引擎定义为gridFS
,可在此处找到:
我似乎在做与Mongoid ORM实现不同的事情。任何帮助都将不胜感激
class MyCustomStorageEngine
def store!(file)
# do custom storage stuff with ActiveResource object here
end
def retrieve!(identifier)
# do custom retrieval stuff with ActiveResource object here
end
end