Skip to content

Commit

Permalink
Merge pull request lardawge#29 from rodacato/master
Browse files Browse the repository at this point in the history
Avoid jobs failed when record no longer exists
  • Loading branch information
lardawge committed Mar 23, 2012
2 parents a37cf91 + b2433d5 commit 5c76e22
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/backgrounder/workers/process_asset.rb
Expand Up @@ -11,14 +11,17 @@ def self.perform(*args)

def perform
resource = klass.is_a?(String) ? klass.constantize : klass
record = resource.find id
record.send(:"process_#{column}_upload=", true)
if record.send(:"#{column}").recreate_versions! && record.respond_to?(:"#{column}_processing")
record.update_attribute :"#{column}_processing", nil
record = resource.find_by_id id

if record
record.send(:"process_#{column}_upload=", true)
if record.send(:"#{column}").recreate_versions! && record.respond_to?(:"#{column}_processing")
record.update_attribute :"#{column}_processing", nil
end
end
end

end # ProcessAsset

end # Workers
end # Backgrounder

0 comments on commit 5c76e22

Please sign in to comment.