cirandas.net

ref: master

app/jobs/create_thumbnails_job.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
class CreateThumbnailsJob < Struct.new(:class_name, :file_id)
  def perform
    return unless class_name.constantize.exists?(file_id)
    file = class_name.constantize.find(file_id)
    file.create_thumbnails
    article = Article.where(:image_id => file_id).first
    if article
      article.touch
    end
  end
end