-
Notifications
You must be signed in to change notification settings - Fork 245
Open
Description
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
endAnd then my worker:
class PhotoProcessor
@queue = :paperclip
def self.perform(photo_id)
puts "***************"
puts photo_id
end
endI 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.
Metadata
Metadata
Assignees
Labels
No labels