Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resque enqueue #74

Open
dflynn15 opened this issue Dec 20, 2012 · 1 comment
Open

Resque enqueue #74

dflynn15 opened this issue Dec 20, 2012 · 1 comment

Comments

@dflynn15
Copy link

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.

@jrgifford
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants