我在 rails 3 应用程序上使用carrierwave 和 mongoid,并且遇到了 after_save 回调的问题。考虑以下
class Video
include Mongoid::Document
field :name
mount_uploader :file, VideoUploader
after_create :enqueue_for_encoding
protected
def enqueue_for_encoding
// point your encoding service to where it expects the permanent file to reside
// in my case on s3
end
end
我的问题是,在我的enqueue_for_encoding
方法中,file.url 指向本地 tmp 目录而不是 s3 目录。
enqueue_for_encoding
当 file.url 指向 s3 时,如何调用我的方法?
谢谢!
乔纳森