delayed_paperclip icon indicating copy to clipboard operation
delayed_paperclip copied to clipboard

Resque enqueue

Open dflynn15 opened this issue 12 years ago • 1 comments

So I am trying to set this up using Resque, but I can't seem to understand where the enqueue is. I have a worker set up to listen for the queue paperclip, but it never seems to be caught. I am clearly missing something, but I can't fully understand what all is going on, so any help or further explanation would be great.

My model:

require 'open-uri'

class Entry < ActiveRecord::Base
  attr_accessible :approved, :entry_text, :reviewed, :user_id, :photo, :image_url

  has_attached_file :photo,
    :styles => { :small => "250x250", :large => "500x500>" },
    :url => "the-s3-url",
    :path => "entries/:id/:basename.:extension"


  before_validation :download_remote_image, :if => :image_url_provided?
  validates_presence_of :image_url, :if => :image_url_provided?, :message => 'is invalid or inaccessible'

  process_in_background :photo

  private

  def image_url_provided?
    if(self.image_url.blank?)
      # Sean's stuff goes here
      return false
    end
    return true
  end

  def download_remote_image
    io = open(URI.parse(image_url))
    self.photo_file_name = io.base_uri.path.split('/').last
    self.photo = io
    self.image_url = image_url
  rescue # catch url errors
  end

end

And then my worker:

class PhotoProcessor
    @queue = :paperclip
    def self.perform(photo_id)
        puts "***************"
        puts photo_id
    end
end

I am missing something, especially seeing that I cannot even reach the self.perform method in the worker. Am I just missing something? Thanks for any advice, I just can't quite figure out where the enqueue process is occurring and why my worker seems to not be listening.

dflynn15 avatar Dec 20 '12 19:12 dflynn15

Hello! I'm the new maintainer, and if you could please refile this bug over at the new bugtracker at jrgifford/delayed_paperclip, I'd appreciate it, that way I can keep track of things in one place.

jrgifford avatar Dec 20 '12 22:12 jrgifford