Skip to content

Commit

Permalink
Prevent ActiveRecord::RecordNotFound errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rodacato committed Feb 24, 2012
1 parent a37cf91 commit b2433d5
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 b2433d5

Please sign in to comment.