回形针回调或简单的处理器?回形针、回调、处理器、简单

2023-09-11 09:02:32 作者:天使也無奈

我想跑回调 after_post_process ,但它似乎没有使用回形针2.3.8对Rails 3.0.1的工作。它给出了一个错误:

I wanted to run the callback after_post_process but it doesn't seem to work in Rails 3.0.1 using Paperclip 2.3.8. It gives an error:

undefined method `_post_process_callbacks' for #<Class:0x102d55ea0>

我想打电话给熊猫API该文件已被上传后。我会创造我自己的处理器这一点,但由于熊猫处理的处理,并可以上传文件,以及和队列本身不确定的时间我认为回调将做精。但是,回调似乎并不在Rails3工作。​​

I want to call the Panda API after the file has been uploaded. I would have created my own processor for this, but as Panda handles the processing, and it can upload the files as well, and queue itself for an undetermined duration I thought a callback would do fine. But the callbacks don't seem to work in Rails3.

after_post_process :panda_create

    def panda_create
      video = Panda::Video.create(:source_url => mp3.url.gsub(/[?]\d*/,''), :profiles => "f4475446032025d7216226ad8987f8e9", :path_format => "blah/1234")
    end

我想需要的,包括回纹针在我的模型,但它似乎没有关系。

I tried require and include for paperclip in my model but it didn't seem to matter.

Anyideas?

推荐答案

解决方案...

我把回调has_attached给定的模式,在回形针后,它精美的作品。我只是习惯了总是把回调在所有车型上,这并没有想到我直到后来。

I put the callback after the paperclip has_attached in the given model and it works beautifully. I was just so used to always putting the callback at the top of all models that this didn't occur to me til later.