Code Monkey home page Code Monkey logo

Comments (8)

Bertg avatar Bertg commented on July 18, 2024

Hi,

What case do you mean exactly?

  • The callback is not called during the "front end" process, but later during the DJ process.
  • The callback is never called, not even during the DJ process.

from delayed_paperclip.

rnaud avatar rnaud commented on July 18, 2024

From my experience the callback are never called.

The correct behavior would be that it they are called during the DJ process.

from delayed_paperclip.

rnaud avatar rnaud commented on July 18, 2024

Alright, here I come again.
Callbacks work, you just need to be sure that the
after_post_process in placed before the process_in_background definition.

However, and this is a big issue. The after_post_process callback is still called before the after save, so the url of the picture is not accessible. So if I want to send a mail with the photo or post a link to facebook with the embeded picture, this is not doable.

How would you go around that issue ? What other callback can I use ?

from delayed_paperclip.

Bertg avatar Bertg commented on July 18, 2024

The problem lays with the method url_with_processed. This method will use the default_url options as long as the processing hasn't happend.

When joining this project this functionality was present and I kept it during the rewrite.

However, at my job where we are using this feature, we disagreed with the reasoning behind this method. We believe that when the file exists, its URL should also exist. It's the controller's job to handle the "not jet processed" case.
We removed the method and are using the original url method provided by paperclip.

In your case there are a few things you could do.

  • In the mail use the url_without_processed method
  • remove the url_with_processed method and restore the original url method

If you'd like to see this url behaviour change, please let me know. Or should we make it a configurable option?

from delayed_paperclip.

rnaud avatar rnaud commented on July 18, 2024

Wow I didn't know about the url_without_processed method, that is great, I'll try that right away.

from delayed_paperclip.

Bertg avatar Bertg commented on July 18, 2024

Hi,

I was wondering if this solved your issue. If so, the latest git/HEAD version now has ":url_with_processing => false" which will not modify the URL while processing.

from delayed_paperclip.

Bertg avatar Bertg commented on July 18, 2024

I'm closing this as there has been no response in almost 2 months.

from delayed_paperclip.

kellydunn avatar kellydunn commented on July 18, 2024

@rnaud I haven't had any success with the solution you mentioned before. My after_attachment_post_process hooks are still not calling. I've also tried the fix mentioned by @Bertg by changing the options inside of delayed_paperclip.

Could you elaborate on your solution to get callbacks working?

EDIT

my current apprach has been to create a config/initializers/delayed_paperclip.rb file with the following contents:

DelayedPaperclip.options[:url_without_processed] = false

But it only seems to be executing the after_attachment_post_process callback, while the rails family of callbacks appears to be running outside of Delayed Job workers. I suspect this is expected functionality. My next step is to try and process the entire model as a Delayed Job.

from delayed_paperclip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.